vba 添加outlook 签名,Excel vba - Outlook签名的格式化已经过去了

在使用VBA发送带有HTML内容的Outlook邮件时,发现在邮件正文中签名显示异常。尝试将`.HTMLBody`改为`.Body`导致情况变得更糟。问题在于邮件格式设置和签名插入。解决方案可能涉及将邮件格式设置为RichText或HTML,并正确设置`MailItem.HTMLBody`。
摘要由CSDN通过智能技术生成

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.

2b706a95d37fde286b3ee5bdb9d70600.png

The output when I run the macro (with .htmlbody).

7d612897d7cd88a8c6caafe67043d7af.png

The output when I run the macro (with .body).

6733dc0baf7057d69193031d03a6e225.png

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值