R
Roy Harrill
I copied the code below right out of Excel VBA Help, changing only the
folder specified in ".Lookin" to "C:\Tsfr". I know this folder exists on my
computer and contains three .doc files. Therefore the code should report
three files found, but instead it erroneously reports no files found. Any
suggestions as to what's going on would be appreciated. Thanks.
Sub Filetest()
Set fs = Application.FileSearch
With fs
.LookIn = "C:\Tsfr"
.Filename = "*.doc"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
MsgBox "There were " & .FoundFiles.Count & " file(s) found."
For Counter = 1 To .FoundFiles.Count
MsgBox .FoundFiles(Counter)
Next Counter
Else
MsgBox "There were no files found."
End If
End With
End Sub
folder specified in ".Lookin" to "C:\Tsfr". I know this folder exists on my
computer and contains three .doc files. Therefore the code should report
three files found, but instead it erroneously reports no files found. Any
suggestions as to what's going on would be appreciated. Thanks.
Sub Filetest()
Set fs = Application.FileSearch
With fs
.LookIn = "C:\Tsfr"
.Filename = "*.doc"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
MsgBox "There were " & .FoundFiles.Count & " file(s) found."
For Counter = 1 To .FoundFiles.Count
MsgBox .FoundFiles(Counter)
Next Counter
Else
MsgBox "There were no files found."
End If
End With
End Sub