opening and closing files in order with vba

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top