Skip to content

Latest commit

 

History

History
72 lines (38 loc) · 1.64 KB

Outlook.MailItem.BodyFormat.md

File metadata and controls

72 lines (38 loc) · 1.64 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
MailItem.BodyFormat property (Outlook)
vbaol11.chm1372
vbaol11.chm1372
Outlook.MailItem.BodyFormat
f635a0bc-20b7-206c-f558-a4ca2519670f
06/08/2017
medium

MailItem.BodyFormat property (Outlook)

Returns or sets an OlBodyFormat constant indicating the format of the body text. Read/write.

Syntax

expression. BodyFormat

expression A variable that represents a MailItem object.

Remarks

The body text format determines the standard used to display the text of the message. Microsoft Outlook provides three body text format options: Plain Text, Rich Text (RTF), and HTML.

All text formatting will be lost when the BodyFormat property is switched from RTF to HTML and vice-versa.

Example

The following Microsoft Visual Basic for Applications (VBA) example creates a new MailItem object and sets the BodyFormat property to olFormatHTML. The body text of the email item will now appear in HTML format.

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

See also

MailItem Object

[!includeSupport and feedback]