Returns the FileSearch object.
The FileSearch object does not accept a uniform resource locator (URL) as a file name or folder name value.
This example searches the Adventure Works web and its subdirectories and returns the number of Index.htm files found in the web.
Note To run this example, you must have a web called "C:\My Documents\My Webs\Adventure Works" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\Adventure Works" (for a server running on Windows NT). As an alternative, you can change the value for LookIn to a web that is currently available to you. You must also set a reference to Microsoft Office Object Library.
Private Sub WebFileSearch()
Dim myFileSearch As FileSearch
Dim myFileCount As Integer
Set myFileSearch = Application.FileSearch
With myFileSearch
.FileName = "index.htm"
.LookIn = "C:\My Webs\Adventure Works"
.SearchSubFolders = True
.Execute
myFileCount = .FoundFiles.Count
End With
End Sub