This documentation is archived and is not being maintained.

MailItem Object

Office 2007
Represents a mail message in an Inbox folder.


Use the CreateItem method to create a MailItem object that represents a new mail message.

Use Items (

index), where index is the index number of a mail message or a value used to match the default property of a message, to return a single MailItem object from an Inbox folder.


The following example creates and displays a new mail message.

Visual Basic for Applications
Set myItem = Application.CreateItem(olMailItem)

The following example sets the current folder as the Inbox and displays the second mail message in the folder.

Visual Basic for Applications
Set myNamespace = Application.GetNamespace("MAPI")
Set myFolder = myNamespace.GetDefaultFolder(olFolderInbox)
Set myItem = myFolder.Items(2)