Results Property

Microsoft Outlook Visual Basic

Results Property

       

Returns a Results collection that specifies the results of the search.

expression.Results

expression   Required. An expression that returns a Search object.

Example

The following event procedure example stores the results of a search in a variable called objRsts and prints the results of the search in the Immediate window. Always use the AdvancedSearchComplete event to ensure the results of the search.

Private Sub Application_AdvancedSearchComplete(ByVal SearchObject As Search)

    Dim objRsts As Results
    MsgBox "The search " & SearchObject.Tag & "has completed. The scope of the search was " & _
        SearchObject.Scope & "."
    Set objRsts = SearchObject.Results
    'Print out number in Results collection
    Debug.Print objRsts.Count
    'Print out each member of Results collection
    For Each Item In objRsts
        Debug.Print Item
    Next

End Sub