Categories Property

Microsoft Outlook Visual Basic

Returns or sets a String representing the categories assigned to the Microsoft Outlook item. Read/write.

expression.Categories

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

Example

The following Microsoft Visual Basic/Visual Basic for Applications (VBA) example creates a new appointment, displays the appointment on the screen, and opens the Show Categories dialog box. Finally, it displays the categories that the user assigned using ShowCategoriesDialog. Replace 'Dan Wilson' with a valid recipient name before running the example.

Sub Appointment()
'Creates an appointment to access ShowCategoriesDialog
    Dim appolApp As Outlook.Application
    Dim olApptItem As Outlook.AppointmentItem
    'Creates an instance of the application
    Set appolApp = Outlook.Application
    'Creates appointment item
    Set olApptItem = appolApp.CreateItem(olAppointmentItem)

    olApptItem.Body = "Please meet with me regarding these sales figures."
    olApptItem.Recipients.Add ("Dan Wilson")
    olApptItem.Subject = "Sales Reports"
    'Display the appointment
    olApptItem.Display
    'Display the Show Categories dialog box
    olApptItem.ShowCategoriesDialog
    MsgBox olApptItem.Categories
End Sub