Filter Property
The DASL statement used to restrict the search to a specified subset of data. This property is set by the Application object's AdvancedSearch method. Read-only String.
expression.Filter
expression Required. An expression that returns a Search object.
Remarks
The Filter property is set by the Filter argument when the Search object is first created.
Example
The following example creates a new Search object. The event subroutine fires after the search has finished and displays the Tag and Filter properties of the Search object as well as the results of the search.
Sub SearchInboxFolder()
'Searches the Inbox
Dim objSch As Search
Const strF As String = _
"urn:schemas:mailheader:subject = 'Office Christmas Party'"
Const strS As String = "Inbox"
Const strTag As String = "SubjectSearch"
Set objSch = _
Application.AdvancedSearch(Scope:=strS, Filter:=strF, Tag:=strTag)
End Sub
Use an AdvancedSearchComplete event subroutine to ensure the integrity of the data stored in the Search object.
Private Sub Application_AdvancedSearchComplete(ByVal SearchObject As Search)
Dim objRsts As Results
MsgBox "The search " & SearchObject.Tag & "has completed. The filter used was " & _
SearchObject.Filter & "."
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