ExpandMembers Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.  

PivotTableExpandEnum

PivotTableExpandEnum can be one of these PivotTableExpandEnum constants.
plExpandAlways Fields and their members are always expanded when added to a PivotTable list. This setting does not prevent the user from collapsing the field once it has been added to the PivotTable list.
plExpandAutomatic default For relational data sources, fields and their members are expanded. For multidimensional data sources, fields and their members are not expanded.
plExpandNever Fields and their members are never expanded when added to a PivotTable list. This setting does not prevent the user from expanding the field once it has been added to the PivotTable list.

 

expression.ExpandMembers

expression   Required. An expression that returns a PivotView object.

Example

This example sets PivotTable1 so that fields are never expanded when they are added to the PivotTable list.

  Sub NeverExpand()
    Dim pvtView
    Dim ptConstants

    Set ptConstants = PivotTable1.Constants

    ' Set a variable to the active view.
    Set pvtView = PivotTable1.ActiveView

    ' Always expand fields when they are added
    ' to a PivotTable list.
    pvtView.ExpandMembers = ptConstants.plExpandNever

    ' Always expand fields when they are added
    ' to the detail area PivotTable list.
    pvtView.ExpandDetails = ptConstants.plExpandNever
End Sub