CommandExecute Event
The document is archived and information here might be outdated

Form.CommandExecute Event

Office 2007
Occurs after the specified command is executed. Use this event when you want to execute a set of commands after a particular command is executed.


expression.CommandExecute(Command, )

expression   A variable that represents a Form object.


NameRequired/OptionalData TypeDescription
CommandRequiredVariantThe command that is executed.

Return Value


The OCCommandId, ChartCommandIdEnum, and PivotCommandId constants contain lists of the supported commands for each of the Microsoft Office Web Components.


The following example demonstrates the syntax for a subroutine that traps the CommandExecute event.

Visual Basic for Applications
Private Sub Form_CommandExecute(ByVal Command As Variant)   MsgBox "The command specified by " _
        & Command.Name & " has been executed."
End Sub

© 2016 Microsoft