FileSearch Property

Microsoft FrontPage Visual Basic

Returns a FileSearch object that provides access to file search capabilities within a Web site.

expression.FileSearch

expression    Required. An expression that returns an Application object.

Remarks

The FileSearch object is a Microsoft Office shared object and does not accept a URL as a file name or folder name value.

Example

The following example searches the Adventure Works Web site and its subdirectories and returns the number of Index.htm files found.

Note  To run this example, you must have a Web site called "C:\My Documents\My Web Sites\Adventure Works". As an alternative, you can change the value for the LookIn property to a Web site that is currently available to you. You may also need to set a reference to the Microsoft Office Object Library (References option on the Tools menu).

Private Sub WebFileSearch()
    Dim myFileSearch As FileSearch
    Dim myFileCount As Integer

    Set myFileSearch = Application.FileSearch

    With myFileSearch
            .FileName = "index.htm"
            .LookIn = "C:\My Web Sites\Adventure Works"
            .SearchSubFolders = True
            .Execute
            myFileCount = .FoundFiles.Count
    End With
End Sub