ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   workbook name changes (https://www.excelbanter.com/excel-programming/418457-workbook-name-changes.html)

aileen

workbook name changes
 
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?


Per Jessen[_2_]

workbook name changes
 
Hi

Maybe this will help you:

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

Regards,
Per

On 13 Okt., 23:01, aileen wrote:
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?



aileen

workbook name changes
 
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.

"Per Jessen" wrote:

Hi

Maybe this will help you:

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

Regards,
Per

On 13 Okt., 23:01, aileen wrote:
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?




aileen

workbook name changes
 
This worked perfectly once I figured out the step I was doing wrong. Thanks
for your help.

"Per Jessen" wrote:

Hi

Maybe this will help you:

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

Regards,
Per

On 13 Okt., 23:01, aileen wrote:
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?





All times are GMT +1. The time now is 11:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com