workbook name changes

  • Thread starter Thread starter aileen
  • Start date Start date
A

aileen

I need to use a workbook name in a macro but the name of the workbook changes
daily with the date. e.g. done101308.xlsx today will be done101408.xlsx
tomorrow. Is there a way to use a workbook name in a macro but have the part
of the name that is the date automatically change with the computer date?
 
Hi

Maybe this will help you:

CurDate = Day(Date) & Month(Date) & Right(Year(Date), 2)
WBname = "done" & CurDate & ".xlsx"

Regards,
Per
 
Hello,

Thanks for the quick response. Should I be able to use WBname as the
workbook name throughout the rest of the macro?

e.g.
CurDate = Day(Date) & Month(Date) & Right(Year(Date), 2)
WBname = "done" & CurDate & ".xlsx"
Workbooks.Open Filename:="C:\Check\Done\WBname"

I am getting a runtime error when I do this, so I am obviously still doing
something wrong. Any help is greatly appreciated.
 
This worked perfectly once I figured out the step I was doing wrong. Thanks
for your help.
 

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