|
大家好,
excel中用vba调用outlook模板发送邮件,但是我想在邮件中利用代码添加上一句话如
Dear xxx,
由于每次人名不同,想通过程序自动实现, 但是现在程序运行后只有我添加的内容, 模板的内容不见了, 请问该如何操作?如何添加内容才能保留模板的的内容?
代码如下:
Dim OutApp As Object
Dim OutMail As Object
Dim MailBody As Range
Dim MailSubject As String
Set OutApp = CreateObject("outlook.Application")
Set OutMail = OutApp.createItemfromtemplate("C:\Users\***\AppData\Roaming\Microsoft\Templates\feedback_template.oft")
MsgBox ("This will send a email to HQ-DE")
With OutMail
.To = "******"
.Subject = "Project number Application"
'.BodyFormat = outlook.OlbodyFormat.olFormatHTML
.HTMLBody = "Dear“+cells(1,1) + "<br>" & _
"Please help to create a P-NO as below" + "<br>" + _
RangetoHTML(MailBody)
.display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
|
|