Creating a new item

Microsoft Outlook

Creating a new item

To create a new item, use the CreateItem method of the Application object. This method returns an object that you can then use to work with the item.

The following Microsoft Visual Basic for Applications example shows how to create a mail message, add text to its subject and body, and display it. To use this sample, create a command button named Command1 on a form.

Private Sub Command1_Click()
    Dim myOLApp As New Outlook.Application
    Dim myOLItem As Outlook.MailItem
    Set myOLItem = myOLApp.CreateItem(olMailItem)
    With myOLItem
        .Subject = "Sample item"
        .Body = "This is a sample message."
    End With
    myOLItem.Display
End Sub

The following example shows how to perform the same task using VBScript in a form.

Sub CommandButton1_Click()
    Set myOLItem = Application.CreateItem(0)
    myOLItem.Subject = "Sample item"
    myOLItem.Body = "This is a sample message."
    myOLItem.Display
End Sub