Share via


Subject Property

Returns or sets a String indicating the subject for the Microsoft Outlook item. This property corresponds to the MAPI property PR_SUBJECT. The Subject property is the default property for Outlook items. Read/write.

Note  For a NoteItem object, the Subject property is a read-only String that is calculated from the body text of the note.

expression**.Subject**

*expression   * Required. An expression that returns one of the objects in the Applies To list.

Example

This Microsoft Visual Basic for Applications (VBA) example creates a new e-mail message, uses the Add method to add "Dan Wilson" as a To recipient, sets the Subject property, and displays the message.

Sub CreateStatusReportToBoss()
    Dim myOlApp As Outlook.Application
    Dim myItem As Outlook.MailItem
    Dim myRecipient As Outlook.Recipient
    Set myOlApp = CreateObject("Outlook.Application")
    Set myItem = myOlApp.CreateItem(olMailItem)
    Set myRecipient = myItem.Recipients.Add("Dan Wilson")
    myItem.Subject = "Status Report"
    myItem.Display
End Sub

If you use Microsoft Visual Basic Scripting Edition (VBScript) in a Microsoft Outlook form, you do not create the Application object, and you cannot use named constants. This example shows how to perform the same task using VBScript code.

Sub CommandButton1_Click()
 Set myItem = Application.CreateItem(0)
 Set myRecipient = myItem.Recipients.Add("Dan Wilson")
 myItem.Subject = "Status Report"
 myItem.Display
End Sub

Applies to | AppointmentItem Object | ContactItem Object | DistListItem Object | DocumentItem Object | JournalItem Object | MailItem Object | MeetingItem Object | NoteItem Object | PostItem Object | RemoteItem Object | ReportItem Object | TaskItem Object | TaskRequestAcceptItem Object | TaskRequestDeclineItem Object | TaskRequestItem Object | TaskRequestUpdateItem Object