Редагувати

Поділитися через


PivotField.CurrentPageList property (Excel)

Returns or sets an array of strings corresponding to the list of items included in a multiple-item page field of a PivotTable report. Read/write Variant.

Syntax

expression.CurrentPageList

expression A variable that represents 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 that 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

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.