A
Anthony
I am using filesearch on a command button to search for a
specific file. The code below works but will return a
count of all files where any part of the file name matches
the search name. I would like the code to search for the
specific file only and return the search results for the
specific file.
Thanks for your help
Anthony
Set fs = Application.FileSearch
With fs
.NewSearch
.LookIn = "C:\download"
.MatchTextExactly = True
.FileName = "HFDWORKREQ.txt"
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 "TRANSFER FILE BEFORE YOU CONTINUE."
End If
End With
specific file. The code below works but will return a
count of all files where any part of the file name matches
the search name. I would like the code to search for the
specific file only and return the search results for the
specific file.
Thanks for your help
Anthony
Set fs = Application.FileSearch
With fs
.NewSearch
.LookIn = "C:\download"
.MatchTextExactly = True
.FileName = "HFDWORKREQ.txt"
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 "TRANSFER FILE BEFORE YOU CONTINUE."
End If
End With