CurrentPageList 属性

       

返回或设置对应于项目列表的字符串数组,该项目列表包含于数据透视表的多项目页字段中。Variant 类型,可读写。

expression.CurrentPageList

expression   必需。该表达式返回一个 PivotField 对象。

说明

为了避免运行错误,数据源必须是 OLAP 源,选择的字段当前必须位于页面位置中,EnableMultiplePageItems 属性必须设置为 True

示例

本示例设置页字段以列出数据透视表的“Food”项目。本示例假定数据透视表位于活动工作表上。

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