PropertyParentField Property

Microsoft Excel Visual Basic

Show All

PropertyParentField Property

       

Returns a PivotField object representing the field to which the properties in this field pertain.

expression.PropertyParentField

expression   Required. An expression that returns a PivotField object.

Remarks

Valid only for fields that are member property fields.

If the IsMemberProperty property is False, using the PropertyParentField property will return a run-time error.

Example

This example determines if there are member properties in the fourth field and, if there are, which fields the properties pertain to. Depending on the findings, Excel notifies the user. This example assumes that a PivotTable exists on the active worksheet and that it is based on an Online Analytical Processing (OLAP) data source.

Sub CheckParentField()

    Dim pvtTable As PivotTable
    Dim pvtField As PivotField

    Set pvtTable = ActiveSheet.PivotTables(1)
    Set pvtField = pvtTable.PivotFields(4)

    ' Check for member properties and notify user.
    If pvtField.IsMemberProperty = False Then
        MsgBox "No member properties present."
    Else
        MsgBox "The parent field of the members is: " & _
            pvtField.PropertyParentField
    End If

End Sub