PropertyTests Collection Object
Description
A collection of PropertyTest objects that represent all the search criteria of a file search. Search criteria are listed in the Advanced Find dialog box (File menu, Open command, Advanced Find button).
Using the PropertyTests Collection
Use the PropertyTests property to return the PropertyTests collection. The following example displays the number of advanced-find search criteria that will be used for one file search.
FileSearch.PropertyTests.Count
Use the Add method to add a new PropertyTest object to the PropertyTests collection. The following example adds two property tests to the search criteria. The first criterion specifies that the found files must be Word documents, and the second one specifies that the found files must have been modified between January 1, 1996 and June 30, 1996.
Set fs = Application.FileSearch
fs.NewSearch
With fs.PropertyTests
.Add Name:="Files of Type", _
Condition:=msoConditionFileTypeWordDocuments, _
Connector:=msoConnectorOr
.Add Name:="Last Modified", _
Condition:=msoConditionAnytimeBetween, _
Value:="1/1/96", SecondValue:="6/30/96", _
Connector:=msoConnectorAnd
End With
Use PropertyTests(index), where index is the index number, to return a single PropertyTest object. The following example displays all the search criteria for the first property test in the PropertyTests collection.
With Application.FileSearch.PropertyTests(1)
myString = "This is the search criteria: " _
& " The name is: " & .Name & ". The condition is: " _
& .Condition
If .Value <> "" Then
myString = myString & ". The value is: " & .Value
If .SecondValue <> "" Then
myString = myString _
& ". The second value is: " _
& .SecondValue & ", and the connector is" _
& .Connector
End If
End If
MsgBox myString
End With
Methods
Add method (PropertyTests collection), Remove method.