Reputation: 115
Once i have opened an appointment in outlook I am then wanting to insert a jpg into the body of the invite by using a vba script, these will be phone details in the form of a jpg.
Const MyPath = "C:\diallist\"
Const MyPicture = "TestDialList.jpg"
Dim myItem As Object
Set myItem = Application.ActiveInspector.CurrentItem()
myItem.MeetingStatus = olMeeting
.Attachments.Add MyPath & MyPicture
.HTMLBody = "<html><p>This is a picture</p>" & "<img src=cid:" & _ Replace(MyPicture, " ", "%20") & " height=240 width=180>"
.Display
End With
Any help is gratefully received.
Upvotes: 0
Views: 1157
Reputation: 66215
Firstly, the ApppointmentItem object does not expose the HTMLBody property, only MailItem does. For the mail item, you need to add the image as an attachment and set its PR_ATTACH_CONTENT_ID property using Attachment.PropertyAccessor.SetProperty to the cid used by the img tag in th HTML body. Again, that will bot work for appointments sicne they only support RTF.
To add a picture to an item currently being displayed, use Application.ActiveInspector.WordEditor.Shapes.AddPicture
.
Upvotes: 1