ChildItems Method

Applies To

PivotField Object, PivotItem 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 children in the specified field, or children of the specified item. Read-only.

Syntax 1

object.ChildItems(index)

Syntax 2

object.ChildItems

object

Required. The PivotField or PivotItem 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).

Example

This example adds the names of all the child items of the item named "Northwest" to a list box. The list box appears on Sheet1.


Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
Set newListBox = Worksheets("Sheet1").ListBoxes.Add _
    (Left:=10, Top:=72, Width:=144, Height:=144)
Set pvtField = pvtTable.PivotFields("REGION2")
For Each pvtItem In pvtField.PivotItems("Northwest").ChildItems
    newListBox.AddItem (pvtItem.Name)
Next pvtItem
Worksheets("Sheet1").Activate