Class Action (Excel VBA)

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

Item

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

Caption

Returns the caption assigned to the Action object.

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

Content

Returns the content associated to the Action object.

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

Coordinate

Returns the coordinate property of the Action object.

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

Execute

Performs the specified action.

ActiveCell.PivotTable.PivotValueCell.ServerActions(1).Execute

Name

Returns the name of the object.

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

Type

Returns the action type.

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

Actions.Count

Returns the number of objects in the collection.

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

Actions.Item

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)