Add Method (PropertyTests Collection)

Applies To

PropertyTests collection object.

Description

Adds a PropertyTest object to the PropertyTests collection.

Syntax

expression.Add(Name, Condition, Value, SecondValue, Connector)

expression An expression that returns a PropertyTests object.

Name Required String. The name of the property criterion. The name corresponds to a value in the Property box in the Advanced Find dialog box.

Condition Required Variant. The condition of the search criteria. Can be one of the following MsoCondition constants:

  • msoConditionAnyNumberBetween
  • msoConditionAnytime
  • msoConditionAnytimeBetween
  • msoConditionAtLeast
  • msoConditionAtMost
  • msoConditionBeginsWith
  • msoConditionDoesNotEqual
  • msoConditionEndsWith
  • msoConditionEquals
  • msoConditionFileTypeAllFiles
  • msoConditionFileTypeBinders
  • msoConditionFileTypeDatabases

(continued)

  • msoConditionFileTypeExcelWorkbooks
  • msoConditionFileTypeOfficeFiles
  • msoConditionFileTypePowerPointPresentations
  • msoConditionFileTypeTemplates
  • msoConditionFileTypeWordDocuments
  • msoConditionIncludesNearEachOther
  • msoConditionIncludesPhrase
  • msoConditionInTheLast
  • msoConditionInTheNext
  • msoConditionIsExactly
  • msoConditionIsNo
  • msoConditionIsNot
  • msoConditionIsYes
  • msoConditionLastMonth
  • msoConditionLastWeek
  • msoConditionLessThan
  • msoConditionMoreThan
  • msoConditionNextMonth
  • msoConditionNextWeek
  • msoConditionOn
  • msoConditionOnorAfter
  • msoConditionOnorBefore
  • msoConditionThisMonth
  • msoConditionThisWeek
  • msoConditionToday
  • msoConditionTomorrow
  • msoConditionYesterday

Value Optional Variant. The value of the search criterion to test for.

SecondValue Optional Variant. An upper value for the search range. You can use this argument only if Condition is msoConditionAnyTimeBetween or msoConditionAnyNumberBetween.

Connector Optional Variant. Specifies the way two search criteria are combined. Can be either of the following MsoConnector constants: msoConnectorAnd or msoConnectorOr.

Example

This example adds two property tests to the search criteria. The first test is that the found files must be Word documents, and the second test is 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