Class Action (Excel VBA)

The class Action represents an action to be executed in a PivotTable or sheet data.


To use a Action class variable it first needs to be instantiated, for example

Dim act as Action
Set act = ActiveCell.PivotTable.PivotValueCell.ServerActions(Index:=1)

Action class variables can be set using the Actions.Item procedure.

For Each

Here is an example of processing the Action items in a collection.

Dim actServerAction As Action
For Each actServerAction In ActiveCell.PivotTable.PivotValueCell.ServerActions
Next actServerAction


Returns the caption assigned to the Action object.

Dim strCaption As String
strCaption = ActiveCell.PivotTable.PivotValueCell.ServerActions(1).Caption


Returns the content associated to the Action object.

Dim strContent As String
strContent = ActiveCell.PivotTable.PivotValueCell.ServerActions(1).Content


Returns the coordinate property of the Action object.

Dim strCoordinate As String
strCoordinate = ActiveCell.PivotTable.PivotValueCell.ServerActions(1).Coordinate


Performs the specified action.



Returns the name of the object.

Dim strName As String
strName = ActiveCell.PivotTable.PivotValueCell.ServerActions(1).Name


Returns the action type.

xlActionTypeDrillthrough - Drill through, xlActionTypeReport - Report, xlActionTypeRowset - Rowset, xlActionTypeUrl - URL.
Dim xatType As XlActionType
xatType = ActiveCell.PivotTable.PivotValueCell.ServerActions(1).Type


Returns the number of objects in the collection.

Dim lngCount As Long
lngCount = ActiveCell.PivotTable.PivotValueCell.ServerActions.Count


Returns an Actions object that represents a collection of actions in a workbook.

Item (Index)

Index: Index value of the action.

Dim actItem As Action
Set actItem = ActiveCell.PivotTable.PivotValueCell.ServerActions(Index:=1)