AllIncludeExclude Property

Microsoft Office Web Components Visual Basic

that represents the inclusion state of all members that are not listed in the IncludedMembers or ExcludedMembers lists for the specified field set. Read/write.

expression.AllIncludeExclude

expression    Required. An expression that returns a PivotFieldSet object.

Example

This example sets the included and excluded members of the Store State and Store City fields in PivotTable1. Members not listed in the include and exclude lists are excluded.

Sub MemberFiltering()

    Dim fldStoreCity
    Dim fldStoreState
    Dim ptView
    Dim ptConstants

    Set ptConstants = PivotTable1.Constants

    ' Set a variable to the current PivotTable view.
    Set ptView = PivotTable1.ActiveView

    ' Set a variable to the Store State field.
    Set fldStoreState = ptView.FieldSets("Store").Fields("Store State")

    ' Set a variable to the Store City field.
    Set fldStoreCity = ptView.FieldSets("Store").Fields("Store City")

    ' Exclude California and Washington from the Store State field.
    fldStoreState.ExcludedMembers = Array("CA", "WA")

    ' Include members of the Store City field. Note that the cities are
    ' in states that have been excluded by the previous line. Since
    ' Store State is a parent to Store City, then the excluded states
    ' are displayed in the PivotTable.
    fldStoreCity.IncludedMembers = Array("Los Angeles", "San Diego", _
                                         "Seattle", "Spokane")

    ' Exclude all members that are not in the list for the IncludedMembers and
    ' ExcludedMembers properties.
    ptView.FieldSets("Store").AllIncludeExclude = ptConstants.plAllExclude

End Sub