File Search

J

John Lane

I have the following code:

Dim fs As Object
Dim i As Integer

Set fs = Application.FileSearch
With fs
.NewSearch
.SearchSubFolders = True
.MatchTextExactly = True
.LookIn = "C:\"
.FileName = "msaccess.exe"
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

It returns the file/pathname four times, apparantely one for each subfolder level.
How do I get it to return only one? Does it work right in NT or XP? Thanks.
 

Ask a Question

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.

Ask a Question

Top