PivotTableChange Event
Occurs whenever the specified PivotTable view field, field set, or total is added or deleted.
Private Sub Form_PivotTableChange(ByVal Reason As Long)
Reason Specifies how the PivotTable list changed. Can be one of the PivotTableReasonEnum constants.
plPivotTableReasonTotalAdded |
plPivotTableReasonFieldSetAdded |
plPivotTableReasonFieldAdded |
Example
The following example demonstrates the syntax for a subroutine that traps the PivotTableChange event. For this example to work, a reference must be set to the Microsoft Office Web Components 10.0 type library.
Private Sub Form_PivotTableChange(Reason As Long)
Select Case Reason
Case OWC.plPivotTableReasonTotalAdded
MsgBox "A total was added!"
Case OWC.plPivotTableReasonFieldSetAdded
MsgBox "A field set was added!"
Case OWC.plPivotTableReasonFieldAdded
MsgBox "A field was added!"
End Select
End Sub