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.
The OCCommandId, ChartCommandIdEnum, PivotCommandId, and SpreadsheetCommandId constants contain lists of the supported commands for each of the Office Web Components.
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