共用方式為


Outlook) (MailItem.BodyFormat 屬性

會傳回或設定 OlBodyFormat 常數,指出本文的格式。 讀取/寫入。

語法

expressionBodyFormat

表達 代表 MailItem 物件的 變數。

註解

本文格式會決定用來顯示郵件文字的標準。 Microsoft Outlook 提供三個本文文字格式選項:純文字、RTF (RTF) 和 HTML。

BodyFormat 屬性從 RTF 切換成 HTML 時,所有文字格式都會遺失,反之亦然。

範例

下列 Microsoft Visual Basic for Applications (VBA) 範例會建立新的 MailItem 物件,並將 BodyFormat 屬性設定為 olFormatHTML。 電子郵件專案的本文現在會以 HTML 格式顯示。

Sub CreateHTMLMail() 
 
 'Creates a new email item and modifies its properties. 
 
 Dim objMail As MailItem 
 
 
 
 'Create mail item 
 
 Set objMail = Application.CreateItem(olMailItem) 
 
 With objMail 
 
 'Set body format to HTML 
 
 .BodyFormat = olFormatHTML 
 
 .HTMLBody = "<HTML><H2>The body of this message will appear in HTML.</H2><BODY>Type the message text here. </BODY></HTML>" 
 
 .Display 
 
 End With 
 
End Sub

另請參閱

MailItem 物件

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應