Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default 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?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default 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?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default 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?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default 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?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exceeding 65K of defined names within workbook causes workbook to go into repair mode when it is opened Ronald Dodge[_2_] Excel Programming 13 May 18th 07 02:24 PM
loop through a column on a workbook copying data on each row to another workbook, then copy data back to the original workbook burl_rfc Excel Programming 1 April 1st 06 08:48 PM
Select sheet tabs in workbook & save to separate workbook files stratocaster Excel Worksheet Functions 2 March 1st 06 03:35 PM
Running a macro to protect a workbook on a already protected workbook UNprotects the workbook ?? WimR Excel Programming 9 July 25th 05 12:44 PM
What commands do you use to name a workbook, save a workbook,open a workbook Steven R. Berke Excel Programming 1 July 24th 03 11:37 PM


All times are GMT +1. The time now is 06:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"