VBA Outlook插入图像到约会



一旦我在outlook中打开了一个约会,我就想通过使用vba脚本在邀请正文中插入一个jpg,这些将是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

感谢您的帮助。

首先,ApppointmentItem对象不公开HTMLBody属性,只有MailItem公开。对于邮件项目,您需要将图像添加为附件,并使用attachment.com propertyaccessor . setproperty将其PR_ATTACH_CONTENT_ID属性设置为HTML正文中img标记使用的cid。同样,这也不能用于约会,因为它们只支持RTF。

为当前显示的项目添加图片,使用Application.ActiveInspector.WordEditor.Shapes.AddPicture

最新更新