【问题标题】:Keep formatting of Outlook signature when creating mail创建邮件时保留 Outlook 签名的格式
【发布时间】:2013-03-23 09:42:18
【问题描述】:

我从How can I use Outlook to send email to multiple recipients in Excel VBA 复制了整个代码块,并在电子邮件末尾添加了一个签名。

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

这就是签名的外观。

除签名外,输出正常。

我尝试将 .htmlbody 更改为 .body,但结果更糟。

.body 的输出。

我正在使用 Excel/Outlook 2007。

【问题讨论】:

    标签: excel vba email outlook-2007


    【解决方案1】:

    您需要将消息的格式设置为 RichText 或 HTMLFormat

    类似 olFormatHTMLolFormatRichText

    然后使用 MailItem.HTMLBody="...."

    VBA MVP Legend Ron De Bruin的网站上有更多信息

    Example Code for sending mail from Excel

    【讨论】:

    猜你喜欢
    • 2017-07-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多