Share via


FileSearch Property [Publisher 2003 VBA Language Reference]

Returns a FileSearch object (Microsoft Office 2003 Visual Basic Reference) that can be used to search for files using either an absolute or relative path.

expression.FileSearch

expression Required. An expression that returns one of the objects in the Applies To list.

Example

This example displays, in a series of message boxes, the file names of all Publisher files in the specified folder. (Note that PathToFolder must be replaced with a valid folder path for this example to work.)

Sub SearchForFiles()

    Dim intCount As Integer

    With Application.FileSearch
        .FileName = "*.pub"
        .LookIn = "PathToFolder"
        .Execute
        For intCount = 1 To .FoundFiles.Count
            MsgBox .FoundFiles(intCount)
        Next intCount
    End With

End Sub

Applies to | Application Object