CommandExecute Event

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

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

Private Sub object**_CommandExecute (ByVal Command As Variant, ByVal Succeeded As Boolean)**

object   A ChartSpace, PivotTable, or Spreadsheet object.

Command The command that has been executed.

Succeeded  Returns True if the command succeeded.

Remarks

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

Example

This example writes the current date and time to a HTML text box control every time that PivotTable1 is refreshed.

  Sub PivotTable1_CommandExecute(Command, Succeeded)

   Dim ptConstants

   Set ptConstants = PivotTable1.Constants

   ' Check to see if the PivotTable list has been refreshed.
   If Command = ptConstants.plCommandRefresh Then

      ' Write the current data and time to the text box.
      TextBox.Value = "PivotTable Last Refeshed on " & _
                      Date & " at " & Time

   End If

End Sub