CubeField.AddMemberPropertyField Method (Excel)

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

expression .AddMemberPropertyField(Property, PropertyOrder, PropertyDisplayedIn)

expression A variable that represents a CubeField object.

Parameters

Name

Required/Optional

Data Type

Description

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 with which the member property is associated. 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.

PropertyDisplayedIn

Optional

XlPropertyDisplayedIn

Specifies where to display the property. If this argument is omitted, the member property field will be added to the PivotTable only.

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.

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

Community Additions

ADD
Show:
© 2014 Microsoft