Iterate through files in a folder on Hard Drive
almost there yourself ...
directory = "T:\Completed Models\"
f = Dir(directory & "*.xls", 7)
Do While f<""
Result = directory & f
f = Dir()
Loop
just the one additional line. Without any parameters, DIR
will return the next file in the last found folder
Patrick Molloy
Microsoft Excel MVP
-----Original Message-----
How do I iterate through file names in a folder on a
hardrive? I already
have the code to set the Path and give me the name of
ONE of the files....b
ut I can't seem to loop through to all files in the
folder:
'This code just keeps repeating the same file name in
the folder yet there
are 20 files in the folder. I need it to scroll through
all 20
directory = "T:\Completed Models\"
f = Dir(directory & "*.xls", 7)
Do While f<""
Result = directory & f
Loop
.
|