Thread
:
Find Files
View Single Post
#
3
Posted to microsoft.public.excel.programming
Bill[_30_]
external usenet poster
Posts: 89
Find Files
Thanks for your suggestion. Unfortunately that did not work.
"William" wrote in message
...
Bill
Try inserting the following line after the ".LookIn" line in your code..
.-------
.SearchSubFolders = True
-------
--
XL2003
Regards
William
"Bill" wrote in message
ink.net...
Hello,
I am using the following code to find a file on the C drive. The file is
there, but the code keeps saying no file was found. Any help? Thanks.
Sub test()
Set fs = Application.FileSearch
With fs
.LookIn = "C"
.Filename = "Fname.xls"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) 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
End Sub
Reply With Quote
Bill[_30_]
View Public Profile
Find all posts by Bill[_30_]