opening and closing files in order with vba

S

shane

I am wanting to open and close a excel file named PS 01-01-98 through PS 01-01-2004 in order and extract data from each file untill I reach the last file. I already have the code written to extract the data, but am not sure how to open the next filename in order. Any help would be greatly appreciated
thanks, shane
 
G

Greg Koppel

Hi Shane,

myFile = Dir(" path to the first file in the folder... \FirstFile.xls")
Do Until myFile=""
perform the operations on myFile
myFile=Dir() NOTE: Do not include the path to the folder here
Loop

HTH, Greg

shane said:
I am wanting to open and close a excel file named PS 01-01-98 through PS
01-01-2004 in order and extract data from each file untill I reach the last
file. I already have the code written to extract the data, but am not sure
how to open the next filename in order. Any help would be greatly
appreciated.
 
Top