CommandExecute Event

Microsoft Office Web Components Visual Basic

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