FindMember Property

Microsoft Office Web Components Object Model

Show All

FindMember Property

       

FindMember property as it applies to the PivotFieldSet object.

Finds a member, given a reference to the member. Returns a PivotMember object.

expression.FindMember(NameOrPath, Format)

expression   Required. An expression that returns a PivotFieldSet object.

NameOrPath  Required Variant. A variable or string that contains a reference to the member to find.

Format  Optional PivotMemberFindFormatEnum. Indicates the format used for the Path argument.

PivotMemberFindFormatEnum can be one of these PivotMemberFindFormatEnum constants.
plFindFormatMember  Not supported for this property.
plFindFormatPathHex  Not supported for this property.
plFindFormatPathInt  Not supported for this property.
plFindFormatPathName  Member reference is a unique name or can be a name if unambiguous. For example, "[USA].[Oregon].[Portland]".

 

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

Finds a member, given a reference to the member. Returns a PivotMember object.

expression.FindMember(Path, Format)

expression   Required. An expression that returns one of the above objects.

Path  Required String. A variable or string that contains a reference  to the member to find.

Format  Required PivotMemberFindFormatEnum. Indicates the format used for the Path argument.

PivotMemberFindFormatEnum can be one of these PivotMemberFindFormatEnum constants.
plFindFormatMember  Not supported for this property.
plFindFormatPathHex  Not supported for this property.
plFindFormatPathInt  Member reference is a path of indexes. For example, "1\0\5\1".
plFindFormatPathName  Member reference is a unique name or can be a name if unambiguous. For example, "[USA].[Oregon].[Portland]".

 

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