Example

Use the property to return the CubeField object. This example creates a list of the cube field names for all the hierarchy fields in the first OLAP-based PivotTable report on Sheet1.

Visual Basic for Applications
Set objNewSheet = Worksheets.Add objNewSheet.Activate intRow = 1 For Each objPF in _ Worksheets("Sheet1").PivotTables(1).PivotFields If objPF.CubeField.CubeFieldType = xlHierarchy Then objNewSheet.Cells(intRow, 1).Value = objPF.Name intRow = intRow + 1 End If Next objPF

Use CubeFields(), where is the cube field's index number, to return a single CubeFieldobject. The following example determines the name of the second cube field in the first PivotTable report on the active worksheet.

Visual Basic for Applications
strAlphaName = _ ActiveSheet.PivotTables(1).CubeFields(2).Name
Cube Field Object

See also:

index index