CommandBarButton.Click Event
Office Developer Reference |
Occurs when the user clicks a CommandBarButton object.
Note |
---|
The use of CommandBars in some Microsoft Office applications has been superseded by the new Ribbon user interface. For more information, search help for the keyword "Ribbon." |
Syntax
expression.Click(Ctrl, CancelDefault)
expression A variable that represents a CommandBarButton object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
Ctrl | Required | CommandBarButton | Represents a CommandBar button |
CancelDefault | Required | Boolean | Is False if the default behavior associated with the CommandBarButton controls 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.
Example
The following example creates a command bar button on the File menu of the host application that enables the user to save a workbook as a comma-separated value file. (This example works in all applications, but the context of saving as CSV is applicable to Microsoft Office Excel.)
Visual Basic for Applications |
---|
|
See Also