The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

NewSearch Method

Office 2003

Some of the content in this topic may not be applicable to some languages.

Resets all the search criteria settings to their default settings.


expression    Required. An expression that returns a FileSearch object.


Search criteria settings are retained throughout an application session. Use this method every time you change search criteria. This method will not reset the value of the LookIn property.


This example uses the NewSearch method to reset the default search criteria before beginning a new search.

With Application.FileSearch
    .LookIn = "C:\My Documents"
    .SearchSubFolders = True
    .FileName = "run"
    .TextOrProperty = "San*"
    .MatchAllWordForms = True
    .FileType = msoFileTypeAllFiles
    If .Execute() > 0 Then
        MsgBox "There were " & .FoundFiles.Count & _
        " file(s) found."
        For i = 1 To .FoundFiles.Count
            MsgBox .FoundFiles(i)
        Next i
        MsgBox "There were no files found."
    End If
End With

Applies to | FileSearch Object