【问题标题】:How do I add an Image in my code?如何在我的代码中添加图像?
【发布时间】:2014-08-13 17:06:34
【问题描述】:
Sub SendBirthdayMessage()
    Dim olkContacts As Outlook.Items, _
        olkContact As Object, _
        olkMsg As Outlook.MailItem
    Set olkContacts = Session.GetDefaultFolder(olFolderContacts).Items
    For Each olkContact In olkContacts
        If olkContact.Class = olContact Then
            If (Month(olkContact.Birthday) = Month(Date)) And (Day(olkContact.Birthday) = Day(Date)) Then
                Set olkMsg = Application.CreateItem(olMailItem)
                With olkMsg
                    .Recipients.Add olkContact.Email1Address
                    'Change the subject as needed'
                    .Subject = "Happy Birthday " & olkContact.FirstName
                    'Change the message as needed'
                    .HTMLBody = "ICD wanted to wish you a Happy Birthday Today!!!"
                    'Change Display to Send if you want the messages sent automatically'
                    .Send
                End With
            End If
        End If
    Next
    Set olkMsg = Nothing
    Set olkContact = Nothing
    Set olkContacts = Nothing
End Sub

【问题讨论】:

  • 您遇到了什么问题?

标签: vba outlook insert photo


【解决方案1】:

HTML 正文必须通过 src:cid 属性 (<img src="cid:xyz">) 引用图像,其中 xyz 是使用 Attachment.PropertyAccessor.SetProperty 在附件上设置的 PR_INTERNET_CONTENT_ID 属性(DASL 名称 http://schemas.microsoft.com/mapi/proptag/0x662A001F)的值。

【讨论】:

    猜你喜欢
    • 2013-05-20
    • 2013-02-06
    • 2017-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-10
    • 1970-01-01
    • 2023-02-03
    相关资源
    最近更新 更多