Article ID: 177091
Article Last Modified on 1/22/2007
Option Explicit
Sub TestSearch()
Dim objFS As Object
Set objFS = Application.FileSearch
With objFS
' Resets all the search criteria settings to their default
' settings.
.NewSearch
' Where to search in Windows 95. For Windows NT 4.0, change
' the path to "C:\Winnt\System32\".
.LookIn = "C:\"
' This will limit the search.
.FileType = msoFileTypeAllFiles
.FileName = "*.SYS"
' Search for "WinDir" within a file. This string is present
' in the file, MSDOS.SYS, in Windows 95. For Windows NT 4.0,
' change to "Invalid."
.TextOrProperty = "WinDir"
' Limit the search to the root.
.SearchSubFolders = False
' Begin the search.
.Execute
End With
' Show the number of files found.
MsgBox "Files found = " & objFS.FoundFiles.Count
End Sub
TestSearch
Files found = 0
.FileType = msoFileTypeAllFiles
Keywords: kbfix kbprb KB177091