FileType Property Example

This example searches for all Binder files located in the My Documents folder. The example displays a message box that contains the name and location of each file that’s found.

Set fs = Application.FileSearch
With fs
    .LookIn = "C:\My Documents"
    .FileType = msoFileTypeBinders
    If .Execute > 0 Then
        MsgBox "There were " & .FoundFiles.Count & _
            " Binder file(s) found."
        For i = 1 To .FoundFiles.Count
            MsgBox .FoundFiles(i)
        Next i
    Else
        MsgBox "There were no Binder files found."
    End If
End With