login
sat_ourne
login
Le 02/12/2010 à 15 h 20 min   

I have search in Outlook to foward mails bodies as we have in Lotus Notes. In fact, when we foward several mails in Outlook, there are fowarded as links to mails. In that case, i want to foward mails bodies in the body of a mail, so I wrote these 2 functions :

[cc lang=”vb”]
Sub FowardMailBodyTo()
Dim myOlApp As New Outlook.Application
Dim myOlExp As Outlook.Explorer
Dim myOlSel As Outlook.Selection
Dim MsgTxt As String
Dim x As Integer
MsgTxt = “”
Set myOlExp = myOlApp.ActiveExplorer
Set myOlSel = myOlExp.Selection
For x = 1 To myOlSel.Count
MsgTxt = MsgTxt & Chr(13) & Chr(13) & myOlSel.Item(x).Body
Next x
Dim myOlMItem As Outlook.MailItem
Dim myOlAtts As Outlook.Attachments
Set myOlMItem = myOlApp.CreateItem(olMailItem)
myOlMItem.Save
myOlMItem.To = “Someone@here.com”
myOlMItem.Subject = myOlSel.Item(1).Subject
myOlMItem.Body = MsgTxt
myOlMItem.Save
End Sub
[/cc]

[cc lang=”vb”]
Sub FowardMailBodyTo_FromStartToAWord()
Dim myOlApp As New Outlook.Application
Dim myOlExp As Outlook.Explorer
Dim myOlSel As Outlook.Selection
Dim MsgTxt, MsgBody, MsgBodySSMerci As String
Dim x As Integer
MsgTxt = “”
CuttingWord = “Merci”
Set myOlExp = myOlApp.ActiveExplorer
Set myOlSel = myOlExp.Selection
For x = 1 To myOlSel.Count
MsgBody = myOlSel.Item(x).Body
MsgBodySSMerci = Left(MsgBody, InStr(MsgBody, CuttingWord) – 1)
MsgTxt = MsgTxt & Chr(13) & Chr(13) & MsgBodySSMerci
Next x
Dim myOlMItem As Outlook.MailItem
Dim myOlAtts As Outlook.Attachments
Set myOlMItem = myOlApp.CreateItem(olMailItem)
myOlMItem.Save
myOlMItem.To = “Someone@here.com”
myOlMItem.Subject = myOlSel.Item(1).Subject
myOlMItem.Body = MsgTxt
myOlMItem.Save
End Sub
[/cc]

Propulsé par WordPress   |   Template réalisé par Graphical Dream et modifié par "Moi"
Haut de page