Share via


CubeField Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.  

Returns the CubeField object from which the specified PivotTable field is descended. Read-only.

expression.CubeField

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

Example

This example creates a list of the cube field names for all the hierarchy fields in the first Online Analytical Processing (OLAP)-based PivotTable report on the first worksheet. This example assumes a PivotTable report exists in the first worksheet.

  Sub UseCubeField()

    Dim objNewSheet As Worksheet
    Set objNewSheet = Worksheets.Add
    objNewSheet.Activate
    intRow = 1

    For Each objPF in _
        Worksheets(1).PivotTables(1).PivotFields
        If objPF.CubeField.CubeFieldType = xlHierarchy Then
            objNewSheet.Cells(intRow, 1).Value = objPF.Name
            intRow = intRow + 1
        End If
    Next objPF

End Sub