创建邮件时保持Outlook签名的格式 [英] Keep formatting of Outlook signature when creating mail

查看:227
本文介绍了创建邮件时保持Outlook签名的格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从


I copied the whole block of code from How can I use Outlook to send email to multiple recipients in Excel VBA and added a signature at the end of the email message.

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 = "<HTML><BODY><FONT face=""Calibri, Arial"">"
    sHTML = sHTML & "<p style=""font-size:11pt"">Hi,</p>"
    sHTML = sHTML & "<p style=""font-size:11pt"">Here is the RMA list WW" & Worksheets("MassEmail").Range("B1") & ".  Please review.</p>"
    sHTML = sHTML & "<pre style=""font-size:11pt;font-family:Calibri,Arial"">     Total: </pre>"
    .HTMLBody = sHTML & Signature
    .HTMLBody = .HTMLBody & "</FONT></BODY></HTML>"
End With

This is how the signature should look.

The output is ok except the signature.

I tried changing .htmlbody to .body, but results are worse.

The output with .body.

I'm using Excel/Outlook 2007.

解决方案

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

Example Code for sending mail from Excel

这篇关于创建邮件时保持Outlook签名的格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆