OrderedMembers Property

Microsoft Office Web Components Visual Basic

expression.OrderedMembers

expression    Required. An expression that returns a PivotField object.

Remarks

Any members in the field that are not listed in this array will appear below the last member listed in the array.

Setting this property replaces the current list. To add items to an existing list, you must retrieve the list and add add members to it, or use a variable to hold the current list, append to it, and reset this property.

It is allowable to pass member names or unique names that currently do not exist in the data results. If you pass a name or unique name that cannot be resolved to a resulting member, it will be converted to a PivotMember object with its IsValid property set to False.

To clear this list, set this property to Empty or an array of zero elements.

Example

This example creates a custom sort order in the Title field.

Sub CustomSort()

   Dim ptConstants
   Dim ptView
   Dim pfTitle

   Set ptConstants = PivotTable1.Constants

   Set ptView = PivotTable1.ActiveView

   ' Set a variable to the Title field.
   Set pfTitle = ptView.FieldSets("Title").Fields("Title")

   ' Specify the ordering for some of the items in the Title field.
   pfTitle.OrderedMembers = Array("Sales Representative", _
                                  "Sales Manager", "Vice President, Sales")

   ' Set the sort direction.
   pfTitle.SortDirection = ptConstants.plSortDirectionCustom

End Sub