我使用Microsoft Access发送电子邮件,并尝试将图像插入电子邮件,以便签名。
我知道,要让收件人看到图像,他们必须能够访问它,因为图像位于我的本地硬盘上,我试图将其嵌入到电子邮件正文中。
我已点击链接:How to add an embedded image to an HTML message in Outlook 2010
拥有以下代码:
Dim MyOutlook As Object
Dim MyMessage As Object
Set MyOutlook = CreateObject("Outlook.Application")
Set MyMessage = MyOutlook.CreateItem(0)
Dim colAttach As Outlook.Attachments
Dim oAttach As Outlook.Attachment
Set colAttach = MyMessage.Attachments
Set oAttach = colAttach.Add("C:\user1\Documents\signature.jpg")
With MyMessage
Dim Greeting As String
If Time >= #12:00:00 PM# Then
Greeting = "Afternoon,"
Else
Greeting = "Morning,"
End If
.To = strTo
.Subject = strSubject
.HTMLBody = "<font face=Arial><p>" & "Good " + Greeting + "</p>"
.HTMLBody = .HTMLBody + "<p>" & "Please find attached your latest document." & "</p>"
.HTMLBody = .HTMLBody + "<p>" & "If you have any questions...." & "</p>"
.HTMLBody = .HTMLBody + "<p>" & "Kind Regards" & "</p>"
.HTMLBody = .HTMLBody + "<p>" & "..." & "</p></font>"
.HTMLBody = .HTMLBody + "<IMG alt='' hspace=0 src='cid:signature.jpg' align=baseline border=0>"
strAttachments = "2"
If strAttachments <> "" Then
For i = 0 To intNrAttch - 1
.Attachments.Add strFiles(i), 1, intPos
Next i
End If
.Send
End With
但出于某种原因,会发生什么事情,它会将图像附加到电子邮件中,但不会显示它:
值得注意的是,我可以使用几乎相同的代码来发送带有Excel工作图像的电子邮件,因此我认为Access会阻止代码工作。
答案 0 :(得分:0)
我有类似的问题。我的#34;修复&#34;是在.Display
之前添加.Send
。