Partager via


CustomPropertyChange Event

Occurs when a custom property of a Microsoft Outlook item is changed. The property name is passed to the procedure so that you can determine which custom property changed.

Subobject**_CustomPropertyChange(ByVal Name As String)**

*object   * An object that evaluates to one of the objects in the Applies To list. In VBScript, use the word Item.

*Name   * Required. The name of the custom property that was changed.

Example

This Microsoft Visual Basic Scripting Edition (VBScript) example uses the CustomPropertyChange event to enable a control when a Boolean field is set to True.

For this example, create two custom fields on the second page of a form. The first, a Boolean field, is named "RespondBy". The second field is named "DateToRespond".

Sub Item_CustomPropertyChange(ByVal myPropName)
    Select Case myPropName
        Case "RespondBy"
            Set myPages = Item.GetInspector.ModifiedFormPages
            Set myCtrl = myPages("P.2").Controls("DateToRespond")
            If Item.UserProperties("RespondBy").Value Then
                myCtrl.Enabled = True
                myCtrl.Backcolor = 65535 'Yellow
            Else
                myCtrl.Enabled = False
                myCtrl.Backcolor = 0 'Black
            End If
        Case Else
    End Select
End Sub

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

See Also | Close Method | CustomAction Event | Forward Event | Open Event | PropertyChange Event | Read Event | Reply Event | ReplyAll Event | Send Method | Using events with Automation | Write Event