Auto Opening a dated workbook

  • Thread starter Thread starter noah
  • Start date Start date
N

noah

I have a macro code that at one point opens a monthly workbook to cop
data to. This monthly workbook's name changes every month due to th
month in the file name.
Example :my macro calls,
Workbooks.Open Filename:= _
"C:\Directory\Folder\Monthly-May '04.xls"
Now every month I have to go into the code and change the month in th
filename. I want to find a way to automate this.
Is there a way I can find the current month and define that so that th
macro can find and open the current month workbook
 
Hi
try the following:

dim fname
fname = "C:\Directory\Folder\Monthly-"
fname=fname & format(date,"MMMM 'YY") & ".xls"
workbooks.open fname
 
Thanks Frank!
that is awesome.
Frank said:
*Hi
try the following:

dim fname
fname = "C:\Directory\Folder\Monthly-"
fname=fname & format(date,"MMMM 'YY") & ".xls"
workbooks.open fname
 
Back
Top