Outlook VBA更改邮件字体大小

时间:2012-07-05 18:09:03

标签: vba outlook

我有改变信息敏感度的代码。它确实有效,但字体大小会改变。代码有问题吗?

Public Sub MakeThisConfidential()
    Application.ActiveInspector.CurrentItem.Sensitivity = olConfidential
    Application.ActiveInspector.CurrentItem.Save
    Set MsgSub = Outlook.Application.ActiveInspector.CurrentItem
    Set objMail = Outlook.Application.ActiveInspector.CurrentItem
    Subject = MsgSub.Subject
    MsgSub.Subject = Subject & " - [CONFIDENTIAL]"
    email = objMail.Body
    info = vbNewLine & "AUTO TEXT: This message has been marked as 'CONFIDENTIAL' please treat it as such"
    objMail.Body = email & info
End Sub

1 个答案:

答案 0 :(得分:4)

您可能希望使用.HTMLBody属性而不是.Body

此外,VBA中的串联字符为&not +

如果使用.Body,您需要使用vbNewLine来创建换行符。如果使用.HTMLBody,则需要使用<p></p>等HTML / CSS语法来创建空间。