FileSearch Property

Microsoft Word Visual Basic

FileSearch Property

       

Returns a FileSearch object that can be used to search for files using either an absolute or relative path.

expression.FileSearch

expression   Required. An expression that returns an Application object.

Example

This example displays, in a series of message boxes, the file names in the My Documents folder that begin with 99.

With Application.FileSearch
    .FileName = "99*.*"
    .LookIn = "C:\My Documents"
    .Execute
    For I = 1 to .FoundFiles.Count
        MsgBox .FoundFiles(I)
    Next I
End With