Share via


AddMemberPropertyField Method [Excel 2003 VBA Language Reference]

Adds a member property field to the display for the cube field.

expression.AddMemberPropertyField(Property, PropertyOrder)

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

Property  Required String. The unique name of the member property. For balanced hierarchies, a unique name can be created by appending the "quoted" member property name to the unique name of the level the member property is associated with. For unbalanced hierarchies, a unique name can be created by appending the "quoted" member property name to the unique name of the hierarchy.

PropertyOrder  Optional Variant. Sets the PropertyOrder property value for a CubeField object. The actual position in the collection will be immediately before the PivotTable field that currently has the same PropertyOrder value that is given in the argument. If no field has the given property order value, the range of acceptable values is 1 to the number of member properties already showing for the hierarchy plus one. This argument is one-based. If omitted, the property goes to the end of the list.

Remarks

The property field specified will not be viewable if the PivotTable view has no fields.

To delete member properties, use the Delete method to delete the PivotField object from the PivotFields collection.

Example

In this example, Microsoft Excel adds a member property field titled "Description" to the PivotTable report view. This example assumes that a PivotTable exists on the active worksheet and that "Country", "Area" and "Description" are items in the report.

Sub UseAddMemberPropertyField()

    Dim pvtTable As PivotTable

    Set pvtTable = ActiveSheet.PivotTables(1)

    With pvtTable
        .ManualUpdate = True
        .CubeFields("[Country]").LayoutForm = xlOutline
        .CubeFields("[Country]").AddMemberPropertyField _
            Property:="[Country].[Area].[Description]"
        .ManualUpdate = False
    End With

End Sub

Applies to | CubeField Object