PivotField.CurrentPageName Property

Excel Developer Reference

Returns or sets the currently displayed page of the specified PivotTable report. The name of the page appears in the page field. Note that this property works only if the currently displayed page already exists. Read/write String.

Syntax

expression.CurrentPageName

expression   A variable that represents a PivotField object.

Remarks

This property applies to PivotTables that are connected to an OLAP data source. Attempting to return or set this property with a PivotTable that is not connected to an OLAP data source will result in a run-time error.

Example

This example sets the name of the currently displayed page of the first PivotTable report on the active worksheet to "USA."

Visual Basic for Applications
  ActiveSheet.PivotTables("PivotTable1") _
    .PivotFields("[Customers]").CurrentPageName = _
        "[Customers].[All Customers].[USA]"

See Also