CurrentPageList Property

Microsoft Excel Visual Basic

expression.CurrentPageList

expression    Required. An expression that returns a PivotField object.

Remarks

To avoid run-time errors, the data source must be an OLAP source, the field chosen must currently be in the Page position, and the EnableMultiplePageItems property must be set to True.

Example

This example sets the page field to list the "Food" items of the PivotTable report. It assumes a PivotTable exists on the active worksheet.

Sub UseCurrentPageList()

    Dim pvtTable As PivotTable
    Dim pvtField As PivotField

    Set pvtTable = ActiveSheet.PivotTables(1)
    Set pvtField = pvtTable.PivotFields("[Product]")

    ' To avoid run-time errors set the following property to True.
    pvtTable.CubeFields("[Product]").EnableMultiplePageItems = True

    ' Set the page list to "Food".
    pvtField.CurrentPageList = "[Product].[All Products].[Food]"

End Sub