FindMember Property

Microsoft Office Web Components Visual Basic

ShowFindMember property as it applies to the PivotAxisMember, PivotColumnMember, PivotMember, PivotPageMember, and PivotRowMember objects.

Remarks

If the requested member is not found, a PivotMember object with the IsValid property set to False is returned. This allows you to refer to a member that might later be added to the schema.

Example

This example attempts to find a specific warehouse in the Warehouse field set. The user is alerted if the specified warehouse is not found.

Sub FindWarehouse()

    Dim ptView
    Dim ptConstants
    Dim fsWarehouse
    Dim pmFound

    Set ptConstants = PivotTable1.Constants

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

    ' Set a variable to the Warehouse field set.
    Set fsWarehouse = ptView.FieldSets("Warehouse")

    ' Set a variable to the results of the FindMember property.
    Set pmFound = fsWarehouse.FindMember("Quality Distribution, Inc.", ptConstants.plFindFormatMember)

    ' Check to see if the member was found.
    If pmFound.IsValid = False Then

        ' Alert the user if the member was not found.
        MsgBox "The specified member does not exist."

    End If

End Sub