.FileSearch Issue

R

rs0905

This code is not returning any files, although there are about 20 files in
the specified file location. The file location is valid and the proper
references are available. Any ideas why this isn't working?

strPath = txtFileLocation

With Application.FileSearch
.NewSearch
.LookIn = strPath
.SearchSubFolders = True
If .FoundFiles.Count > 0 Then
For i = 1 To .FoundFiles.Count
strName = .FoundFiles(i)
strList = strList & strName & ";"
Next i
Else
MsgBox "There were no files found."
End If
End With
 
K

Klatuu

You have not executed the search:
.SearchSubFolders = True
.Execute
If .FoundFiles.Count > 0 Then
 

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