Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Filename with current Date()

Use the Format function to format the current date in to an
acceptable format. E.g.,

ActiveWorkbook.SaveAs Filename:= _
"C:\Data_" & Format(Date, "mm_dd_yyyy") & ".xls", _
FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"toothfish__" wrote in
message ...
Hi All,

I am trying to compile a simple procedure that will name
and save the current workbook with a filename that
includes the system date. But my code is generating a
compile error, please can you review below and let me know
where I am going wrong? thanks,

===

ChDir _
"C:\"
ActiveWorkbook.SaveAs Filename:= _
"C:\Data_"&Date()&".xls" _
, FileFormat:=xlNormal, Password:="",
WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWindow.Close

===



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Filename with current Date()

thanks Chip, this is great it works perfectly.

-----Original Message-----
Use the Format function to format the current date in to

an
acceptable format. E.g.,

ActiveWorkbook.SaveAs Filename:= _
"C:\Data_" & Format(Date, "mm_dd_yyyy") & ".xls", _
FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"toothfish__" wrote

in
message ...
Hi All,

I am trying to compile a simple procedure that will name
and save the current workbook with a filename that
includes the system date. But my code is generating a
compile error, please can you review below and let me

know
where I am going wrong? thanks,

===

ChDir _
"C:\"
ActiveWorkbook.SaveAs Filename:= _
"C:\Data_"&Date()&".xls" _
, FileFormat:=xlNormal, Password:="",
WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWindow.Close

===



.

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
Can I display the current XLS filename in a toolbar? [email protected] Excel Discussion (Misc queries) 1 June 4th 10 12:59 PM
macro to grab current workbook filename TR Young Excel Worksheet Functions 3 June 12th 09 12:41 PM
Enter current date automatically in filename Megadrone Excel Worksheet Functions 1 January 25th 07 03:48 PM
I want a cell to show the current filename automatically. Troy Excel Discussion (Misc queries) 4 January 31st 06 02:32 PM
Append current date to filename Rhonda[_2_] Excel Programming 5 September 16th 03 11:34 AM


All times are GMT +1. The time now is 05:40 PM.

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"