I'm using Excel/Outlook 2007. I copied the whole block of code and added a signature at the end of the email message. The output in the email is ok except the signature. I tried to change .htmlbody to .body in vba, but it results it even worse. Anyone can help?
Thank you.
This is how the signature looks like.
The output when I run the macro (with .htmlbody).
The output when I run the macro (with .body).
My code:
With OutMail
.Display
End With
Signature = OutMail.Body
With OutMail
.To = sTo
.CC = sCC
.BCC = ""
.Subject = Worksheets("MassEmail").Range("A2") & " WW" & Worksheets("MassEmail").Range("B1")
sHTML = "
"sHTML = sHTML & "
Hi,
"sHTML = sHTML & "
Here is the RMA list WW" & Worksheets("MassEmail").Range("B1") & ". Please review.
"sHTML = sHTML & "
Total:"
.HTMLBody = sHTML & Signature
.HTMLBody = .HTMLBody & "
"End With
解决方案
you need to set the format of the messaage to RichText or HTMLFormat
something like olFormatHTML or olFormatRichText
then use MailItem.HTMLBody="...."
there is more information on VBA MVP Legend Ron De Bruin's website