read HELP on the FileSearch object.
The following is copied almost exactly from the help. All I did was reverse
the examples & join them together...I remarked out stuff I didn't want. The
only real change that I made was the file type.
Sub FileList()
With Application.FileSearch
.NewSearch
.LookIn = "C:\My Documents"
.SearchSubFolders = True
''' .Filename = "Run"
''' .MatchTextExactly = True
.FileType = msoFileTypeExcelWorkbooks
'''End With
'''With Application.FileSearch
If .Execute() > 0 Then
MsgBox "There were " & .FoundFiles.Count & " file(s) found."
''' For i = 1 To .FoundFiles.Count
''' MsgBox .FoundFiles(i)
''' Next i
Else
MsgBox "There were no files found."
End If
End With
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.