Export (0) Print
Expand All
2 out of 3 rated this helpful - Rate this topic

Application.CreateItem Method

Office 2007
Creates and returns a new Microsoft Outlook item.

Syntax

expression.CreateItem(ItemType)

expression   A variable that represents an Application object.

Parameters

NameRequired/OptionalData TypeDescription
ItemTypeRequiredOlItemTypeThe Outlook item type for the new item.

Return Value
An Object value that represents the new Outlook item.

Remarks

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.

Example

The following Microsoft Visual Basic/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.

Visual Basic for Applications
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><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



Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.