Export (0) Print
Expand All

Items.ItemChange Event

Office 2007
Occurs when an item in the specified collection is changed. This event is not available in Microsoft Visual Basic Scripting Edition (VBScript).

Syntax

expression.ItemChange(Item)

expression   A variable that represents an Items object.

Parameters

NameRequired/OptionalData TypeDescription
ItemRequiredObjectThe item that was changed.

Example

This example uses the Start property of the AppointmentItem object to determine if the appointment starts after normal business hours. If it does, and if the Sensitivity property of the AppointmentItem object is not already set to olPrivate, the example offers to mark the appointment as private.

Visual Basic for Applications
Public WithEvents myOlItems As Outlook.Items

Public Sub Initialize_handler()
    Set myOlItems = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderCalendar).Items
End Sub

Private Sub myOlItems_ItemChange(ByVal Item As Object)
Dim prompt As String
    If VBA.Format(Item.Start, "h") >= "17" And Item.Sensitivity <> olPrivate Then
        prompt = "Appointment occurs after hours. Mark it private?"
        If MsgBox(prompt, vbYesNo + vbQuestion) = vbYes Then
            Item.Sensitivity = olPrivate
            Item.Display
        End If
    End If
End Sub



Community Additions

ADD
Show:
© 2014 Microsoft