Open a Workbook using VB

  • Thread starter Thread starter cellist
  • Start date Start date
C

cellist

Running EXCEL 2003.

I have an application that the user launches by opening a saved workspace
(.xlw). The saved workspace includes three related workbooks, all loaded from
fixed locations. A fourth workbook is needed, but its location is based on
the current date. I'd rather not rely on the user to figure out which
instance of the workbook to open. Can I run VB code that will figure out the
correct pathname and dynamically open the fourth workbook?

TIA,

Phil
 
you didn't supply a lot of description of what you wanted.

Folder = "c:\temp\"
MyDate = format(now(),"MM_DD_YYYY")
FName = Folder & MyDate
set bk = workbooks.open(filename:=FName)
 
Joel,

Thanks for the info. You've answered my question, even though...
you didn't supply a lot of description of what you wanted.

That's true, I didn't supply much. My question was "in general", rather than
one of "how do I determine the file/path name based on the current date?". I
know how to do that, but did not know -- until you described how -- to use
that pathname, or whether I even could use it.

Now I know!

Phil
 
Back
Top