title | keywords | f1_keywords | api_name | ms.assetid | ms.date | ms.localizationpriority | ||
---|---|---|---|---|---|---|---|---|
Application.CreateItem method (Outlook) |
vbaol11.chm714 |
|
|
e5fbf367-db16-5042-823e-68e6b805e612 |
06/08/2017 |
medium |
Creates and returns a new Microsoft Outlook item.
expression. CreateItem
( _ItemType_
)
expression A variable that represents an Application object.
Name | Required/Optional | Data type | Description |
---|---|---|---|
ItemType | Required | OlItemType | The Outlook item type for the new item. |
An Object value that represents the new Outlook item.
The CreateItem method can only create default Outlook items. To create new items using a custom form, use the Add method on the Items collection.
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 Outlook.MailItem
'Create email 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> Please enter the message text here. </BODY></HTML>"
.Display
End With
End Sub
How to: Import Appointment XML Data into Outlook Appointment Objects
[!includeSupport and feedback]