Share via


PivotField.AddPageItem Method

Excel Developer Reference

Adds an additional item to a multiple item page field.

Syntax

expression.AddPageItem(Item, ClearList)

expression   A variable that represents a PivotField object.

Parameters

Name Required/Optional Data Type Description
Item Required String Source name of a PivotItem object, corresponding to the specific Online Analytical Processing (OLAP) member unique name.
ClearList Optional Variant If False (default), adds a page item to the existing list. If True, deletes all current items and adds Item.

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

In this example, Microsoft Excel adds a page item with a source name titled "[Product].[All Products].[Food].[Eggs]". This example assumes an OLAP PivotTable exists on the active worksheet.

Visual Basic for Applications
  Sub UseAddPageItem()
' The source is an OLAP database and you can manually reorder items.
ActiveSheet.PivotTables(1).CubeFields("[Product]"). _
    EnableMultiplePageItems = True

' Add the page item titled "[Product].[All Products].[Food].[Eggs]".
ActiveSheet.PivotTables(1).PivotFields("[Product]").<strong>AddPageItem</strong> ( _
    "[Product].[All Products].[Food].[Eggs]")

End Sub

See Also