Posted to microsoft.public.excel.programming
|
|
Excel 2007 / application.filesearch no longer works
See
http://www.rondebruin.nl/fso.htm
See also the Merge add-in
http://www.rondebruin.nl/merge.htm
--
Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm
"Pete Ross" wrote in message ...
Hello,
In 2007, the application.filesearch no longer works for my vba scripts, I'm
trying to find a work around, I figured out how to loop through files in a
given folder, but need help creating one more nested loop so that I can loop
through folders, then loop through the files in each folder, here is a sample
of what I have so far, any help would be greatly appreciated.
Dim sFolder As String
Dim Folder As Object
Dim file As Object
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
sFolder = "C:\temp"
'***I have multiple folders in temp, need to find code to loop thru each......
If sFolder < "" Then
Set Folder = fso.GetFolder(sFolder)
For Each file In Folder.Files
MyFile = file
'**** do stuff to each file
Next file
End If
|