.FileSearch Issue

  • Thread starter Thread starter rs0905
  • Start date Start date
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
 
You have not executed the search:
.SearchSubFolders = True
.Execute
If .FoundFiles.Count > 0 Then
 
Back
Top