Bonsoir,
Dans ton code il te manque un
Set oAttach = ColAttach.Add(Environ("Temp") & "\graph2.jpg")
pour ajouter la seconde image.
ensuite si tu veux qu'elles soient bien qualifiés et qu'elle ne soient pas dans les PJ mais juste dans le htmlbody il faut changer leur propriétés.
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
| Sub NewMessage_With_Embedded_Dmitry()
Dim olApp As Outlook.Application
If Application.Name = "Outlook" Then
Set olApp = Application
Else
Set olApp = CreateObject("outlook.application")
End If
Set NS = olApp.Session
Set objOutlookMsg = olApp.CreateItem(olMailItem)
Set objOutlookRecip = objOutlookMsg.Recipients.add("test@toto.com")
objOutlookRecip.Type = olTo
objOutlookMsg.Subject = "test"
' add graphic as attachment to Outlook message
Set colAttach = objOutlookMsg.Attachments
Set l_Attach = colAttach.add("C:\Users\Public\Pictures\pouce.jpg")
l_Attach.propertyAccessor.SetProperty "http://schemas.microsoft.com/mapi/proptag/0x370E001F", "image/jpeg"
'Change From 0x370eE001E
l_Attach.propertyAccessor.SetProperty "http://schemas.microsoft.com/mapi/proptag/0x3712001F", "myident"
'Changed from 0x3712001E
'HideAttachments
objOutlookMsg.propertyAccessor.SetProperty "http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/8514000B", True
'Set body format to HTML
objOutlookMsg.BodyFormat = olFormatHTML
objOutlookMsg.HTMLBody = "<html><p>This is a picture.</p>" & _
"<img src='cid:myident' >"
objOutlookMsg.Save
objOutlookMsg.Display
'objOutlookMsg.Send
End Sub |
Partager