View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Most efficient way to loop through a folder and find all the XLS f

If you want to loop through only the direct children of a directory,
Dir is probably better, or at least probably faster (perceptably
faster, though, is another quesiton). However, if you want to
recursively loop through all files and folders, subfolders, subfolders
of subfolders and so on, the FileSystemObject is much easier to work
with. At http://www.cpearson.com/Excel/RecursionAndFSO.htm I describe
exactly how the FSO can be used in a recursive manner to traverse all
children of a folder.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Tue, 14 Oct 2008 11:05:01 -0700, Barb Reinhardt
wrote:

I've done this a number of ways, but am wondering what the most efficient way
is to loop through a folder. I've used DIR and File Scripting Objects.
Which is the best way?

Thanks,
Barb Reinhardt