View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default How to go through a series of folders without using "folder"?

In VBA, go to the Tools menu, choose References, and put a check
next to "Windows Scripting Runtime". Then you can use code like
the following:

Sub AAA()
Dim F As Scripting.File
Dim FF As Scripting.Folder
Dim FSO As Scripting.FileSystemObject
Set FSO = New Scripting.FileSystemObject
Set FF = FSO.GetFolder("H:\Test")
For Each F In FF.Files
Debug.Print F.Name
Next F
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"davegb" wrote in message
ups.com...
I want to go through all the subfolders of a certain folder and
compare
a variable in the folder names. I looked here for a way to do
this, but
the code I found used "folder" (object, property, method?)
which I
don't have in XL2000. Is there a way around this? Or is there
an add-in
that will add that object/property/method?
Thanks for your help.