TextOrProperty Property

Microsoft Office Object Model

TextOrProperty Property

       

Returns or sets the word or phrase to be searched for, in either the body of a file or the file's properties, during the file search. The word or phrase can include the * (asterisk) or ? (question mark) wildcard character. Read/write String.

Remarks

Use the question mark wildcard character to match any single character. For example, type gr?y to find all files that contain at least one instance of either "gray" or "grey."

Use the asterisk wildcard character to match any number of characters. For example, type San* to return all files that contain at least one word that begins with "San."

Example

This example searches the C:\My Documents folder and all of its subfolders and returns all files whose body text or file properties contain any words that begin with "San." The TextOrProperty property sets the word to be searched for and limits the search to either the body of the file or the file properties.

With Application.FileSearch
    .NewSearch
    .LookIn = "C:\My Documents"
    .SearchSubFolders = True
    .TextOrProperty = "San*"
    .FileType = msoFileTypeAllFiles
End With