NewSearch Method
Applies To
FileSearch object.
Description
Resets all the search criteria settings to their default settings.
Syntax
expression.NewSearch
expression Required. An expression that returns a FileSearch object.
Remarks
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.
See Also
FileSearch object.
Example
This example uses the NewSearch method to reset the default search criteria before beginning a new search.
With Application.FileSearch
.NewSearch
.LookIn = "C:\My Documents"
.SearchSubFolders = True
.FileName = "run"
.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
Else
MsgBox "There were no files found."
End If
End With