ParentItems Method

Applies To

PivotField Object.

Description

Accessor. Returns an object that represents one pivot item (a PivotItem object, Syntax 1) or a collection of all the pivot items (a PivotItems object, Syntax 2) that are group parents in the specified field. The specified field must be a group parent of another field. Read-only.

Syntax 1

object.ParentItems(index)

Syntax 2

object.ParentItems

object

Required. The PivotField object.

index

Required for Syntax 1. The number or name of the pivot item to return (can be an array to specify more than one).

See Also

ChildItems Method, HiddenItems Method, PivotItems Method, VisibleItems Method.

Example

This example adds to a list box the names of all the items that are group parents in the field that contains the active cell. The list box appears on Sheet1.


Worksheets("Sheet1").Activate
Set newListBox = Worksheets("Sheet1").ListBoxes.Add _
    (Left:=10, Top:=72, Width:=144, Height:=144)
For Each pvtItem In ActiveCell.PivotField.ParentItems
    newListBox.AddItem (pvtItem.Name)
Next pvtItem