Export (0) Print
Expand All
Expand Minimize

MailItem.HTMLBody Property (Outlook)

Returns or sets a String representing the HTML body of the specified item. Read/write.

expression .HTMLBody

expression A variable that represents a MailItem object.

The HTMLBody property should be an HTML syntax string.

Setting the HTMLBody property will always update the Body property immediately.

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

Sub CreateHTMLMail() 
 
 'Creates a new e-mail item and modifies its properties. 
 
 Dim objMail As Outlook.MailItem 
 
 
 
 'Create e-mail item 
 
 Set objMail = Application.CreateItem(olMailItem) 
 
 With objMail 
 
 'Set body format to HTML 
 
 .BodyFormat = olFormatHTML 
 
 .HTMLBody = _ 
 
 "<HTML><BODY>Enter the message text here. </BODY></HTML>" 
 
 .Display 
 
 End With 
 
End Sub
Show:
© 2014 Microsoft