CubeField Property Example

CubeField Property Example

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

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