返回或设置 OlBodyFormat 常量指出正文文本的格式。正文文本格式决定了显示邮件文本的标准。Microsoft Outlook 提供了三种正文文本格式选项:纯文本、RTF 和 HTML。OlBodyFormat 常量,可读写。
OlBodyFormat 可为以下 OlBodyFormat 常量之一。 |
olFormatHTML |
olFormatPlain |
olFormatRichText |
olFormatUnspecified |
expression.BodyFormat
expression 必选。该表达式返回“应用于”列表中的一个对象。
当 BodyFormat 属性从 RTF 切换到 HTML 时,所有的文本格式都将丢失,反之亦然。
该属性不能设置为 olFormatUnspecified,但是如果项目尚未显示,它将返回 olFormatUnspecified。
以下示例新建 MailItem 对象,并将 BodyFormat 属性设置成 olFormatRichText。邮件项目的正文文本将以 RTF 格式显示。
Sub NewMail()
'Creates a new Mailitem and modifies its properties
Dim olApp As Outlook.Application
Dim objMail As MailItem
Set olApp = Outlook.Application
'Create mail item
Set objMail = olApp.CreateItem(olMailItem)
With objMail
.DownloadState = olHeaderOnly
'Set body format to Rich Text
.BodyFormat = olFormatRichText
.Display
End With
End Sub