Opening a Succession

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

Guest

Workbooks.OpenText FILENAME:= _
"C:\JDIS_FILES\PURGRPT_" & "*.jdis"


This opens the file in the directory I want to be opened. However my
question is:
If there are say 10 reports with that prefix and suffix in that direcory, is
there a way I can have a macro open the first one, then the next one, then
the next one etc. On down the line until the last one then stop?

Does that make sense?
 
First = True
Do while (1)
if First = True then
MyFilename = Dir("C:\JDIS_FILES\PURGRPT_" & "*.jdis")
First = False
else
MyFileName = Dir()
end if

if MyFilename = "" then exit do
Workbooks.OpenText FILENAME:= MyFileName
loop
 

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