CustomAction Event

Microsoft Outlook Visual Basic

Show All

CustomAction Event

       

Occurs when a custom action of an Outlook item executes. The Action object and the newly-created item resulting from the custom action are passed to the event.

Sub object_CustomAction(ByVal Action As Object, ByVal Response As Object, Cancel As Boolean)

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

Action   Required. The Action object.

Response   Required. The newly-created item resulting from the custom action.

Cancel   Optional (not used in VBScript). False when the event occurs. If the event procedure sets this argument to True, the custom action is not completed.

Remarks

In VBScript, if you set the return value of this function to False, the custom action operation is not completed.

Example

This example uses the CustomAction event to set a property on the response item.

Function Item_CustomAction(ByVal myAction, ByVal myResponse)
    Select Case myAction.Name
        Case "Action1"
            myResponse.Subject = "Changed by VB Script"
        Case Else
    End Select
End Function