我使用以下代码向我的客户发送调查问卷。现在我正在寻找一种方法来在电子邮件中添加我公司的徽标,但是我不确定如何更改代码以实现此目的。
可以得到你对这个问题的支持吗?
谢谢。 马塞洛
Sub mailmerge1()
Application.ScreenUpdating = False
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
Dim table1 As ListObject
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set table1 = ActiveWorkbook.ActiveSheet.ListObjects("Table1")
Set rng = Nothing
Set rng = ActiveSheet.Range("K2:M17")
' You can also use a sheet name here.
'Set rng = Sheets("YourSheet").UsedRange
For i = 1 To table1.ListRows.Count
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
Range("J2") = i
On Error Resume Next
With OutMail
.SentOnBehalfOfName = "tsc@volvo.com"
.To = Range("J5")
.BCC = ""
.Subject = "Let us know what you think"
.HTMLBody = RangetoHTML(rng)
'.Display
' In place of the following statement, you can use ".Display" to
' display the e-mail message.
.send
End With
Next i
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
Set OutMail = Nothing
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub
答案 0 :(得分:0)
实施例
With OutMail
.SentOnBehalfOfName = "tsc@volvo.com"
.To = Range("J5")
.BCC = ""
.Subject = "Let us know what you think"
.Attachments.Add "C:\Users\0m3r\Pictures\Hello.png", olByValue, 0
.HTMLBody = RangetoHTML(rng) & vbCrLf & _
"<BODY><IMG src=""cid:Hello.png"" width=200> </BODY>"
.Display
' In place of the following statement, you can use ".Display" to
' display the e-mail message.
' .Send
End With
请确保不要在徽标文件名上使用空格 -