Click Event

         Example         Applies To

Occurs when the user clicks a CommandBarButton object.

Syntax

Private Sub CommandBarButton_Click

    (ByVal Ctrl As CommandBarButton,

    ByVal CancelDefault As Boolean)

The syntax for the Click event includes the two arguments described in the following table.

Argument Description
Ctrl Required CommandBarButton. Denotes the CommandBarButton control that initiated the event.
CancelDefault Required Boolean. False if the default behavior associated with the CommandBarButton control occurs, unless it’s canceled by another process or add-in.

Remarks

The Click event is recognized by the CommandBarButton object. To return the Click event for a particular CommandBarButton control, use the WithEvents keyword to declare a variable, and then set the variable to the control.