1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| Sub ScriptTrrToRec(myMail As MailItem)
'---------------------------------------------------------------------------------------
' Procedure : TrrToRec
' Author : Oliv'
' Date : 16/11/2014
' Purpose : script a exécuter avec une règle pour transférer au destinataires x
'---------------------------------------------------------------------------------------
'
Dim LeMailTransfere As Outlook.MailItem
Dim StrID As String
Dim olNS As Outlook.NameSpace
Dim msg As Outlook.MailItem
Dim Destinataire, liste
Destinataire="abc@mail.com"
StrID = myMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set msg = olNS.GetItemFromID(StrID)
' do stuff with msg, e.g.
Set LeMailTransfere = msg.Forward
LeMailTransfere.Recipients.add Destinataire
LeMailTransfere.subject="Nouvel objet"
'LeMailTransfere.Display
LeMailTransfere.Send
'ou
'LeMailTransfere.save
'ici on supprime le message initial
msg.delete
Set msg = Nothing
Set olNS = Nothing
End Sub |
Partager