This documentation is archived and is not being maintained.

AddPageItem Method [Excel 2003 VBA Language Reference]

Office 2003

Adds an additional item to a multiple item page field.

expression.AddPageItem(Item, ClearList)

expression Required. An expression that returns one of the objects in the Applies To list.

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.


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.


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.

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]").AddPageItem ( _
        "[Product].[All Products].[Food].[Eggs]")

End Sub

Applies to | PivotField Object