Table of contents
Collapse the table of content
Expand the table of content

Click Event (VBA Add-In Object Model)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

Occurs when the OnActionproperty of a corresponding command bar control is set. SyntaxSubobject_Click (ByValctrlAs Object, ByRefhandledAs Boolean, ByRefcanceldefaultAs Boolean) The Click event syntax has these named arguments:

ctrlRequired; Object. Specifies the object that is the source of the Click event.
handledRequired; Boolean. If True, otheradd-ins should handle the event. If False, the action of the command bar item has not been handled.
canceldefaultRequired; Boolean. If True, default behavior is performed unless canceled by a downstream add-in. If False, default behavior is not performed unless restored by a downstream add-in.

Remarks The Click event is specific to the CommandBarEvents object. Use avariable declared using the WithEvents keyword to receive the Click event for a CommandBar control. This variable should be set to the return value of the CommandBarEvents property of the Events object. The CommandBarEvents property takes the CommandBar control as anargument. When the CommandBar control is clicked (for the variable you declared using the WithEvents keyword), the code is executed.

© 2018 Microsoft