IsValid Property

Microsoft Office Web Components Visual Basic

expression.IsValid

expression    Required. An expression that returns a PivotMember object.

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.plFindFormatPathName)

    ' 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