MemberCaptions Property

Returns or sets an array of Variant values that contains the captions of the members in the specified field. Use this property to customize the captions of the members in a field. Read/write.

expression.MemberCaptions

*expression   * Required. An expression that returns a PivotField object.

Remarks

The array that you pass to this property contains an array for each caption that you want to modify. The first element in the array can contain either a member name, unique name, or a reference to a PivotMember object. The second element in the array is the new caption to be used for the member.

Members not specified in the array will use the default captions provided by the data source.

Note  This property will work only with Online Analytical Processing (OLAP) data sources.

Example

This example replaces the captions in the State Province field of the Customers field set with captions that are more readable.

Sub NewMemberCaptions()

    Dim fldStateCaptions
    Dim avarNewCaptions(2)

    Set fldStateCaptions = PivotTable1.ActiveView.FieldSets("Customers") _
                          .Fields("State Province")

    ' The following three lines of code specify the new captions to
    ' be displayed for the states in the State Province field.
    avarNewCaptions(0) = Array("[State Province].[CA]", "California")
    avarNewCaptions(1) = Array("[State Province].[WA]", "Washington")
    avarNewCaptions(2) = Array("[State Province].[OR]", "Oregon")

    ' Apply the new captions to the State Province field.
    fldStateCaptions.MemberCaptions = avarNewCaptions

End Sub

Applies to | PivotField Object

See Also | PivotMember Object