Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Save date in filename

Hi. I would like to have the current date saved in the
filename when the macro is excercised.

For instance, the filename is "Log File.xls". I would
like a command that, if executed on February 23, it would
save the filename "Log File - 2/23/04.xls.

My current command is:

ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path
& "\Archive\" & "Log File"

What should I add to this command to include the date?

Thanks,
Mike.
  #2   Report Post  
Posted to microsoft.public.excel.programming
RWN RWN is offline
external usenet poster
 
Posts: 104
Default Save date in filename

"Log file-" & Date

--
Regards;
Rob
------------------------------------------------------------------------
"Mike" wrote in message
...
Hi. I would like to have the current date saved in the
filename when the macro is excercised.

For instance, the filename is "Log File.xls". I would
like a command that, if executed on February 23, it would
save the filename "Log File - 2/23/04.xls.

My current command is:

ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path
& "\Archive\" & "Log File"

What should I add to this command to include the date?

Thanks,
Mike.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Save date in filename

Rob:

Thanks for your reply. When I try this, I get a run time
error. It says it cannot access the file ....
\Archive\Log File-2\23.

It appears as if it is treating the slashes in the date
as directory paths ... Any ideas?

Thanks,
Mike.

-----Original Message-----
"Log file-" & Date

--
Regards;
Rob
---------------------------------------------------------

---------------
"Mike" wrote in

message
...
Hi. I would like to have the current date saved in the
filename when the macro is excercised.

For instance, the filename is "Log File.xls". I would
like a command that, if executed on February 23, it

would
save the filename "Log File - 2/23/04.xls.

My current command is:

ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path
& "\Archive\" & "Log File"

What should I add to this command to include the date?

Thanks,
Mike.



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
RWN RWN is offline
external usenet poster
 
Posts: 104
Default Save date in filename



--
Regards;
Rob
------------------------------------------------------------------------
"Mike" wrote in message
...
Rob:

Thanks for your reply. When I try this, I get a run time
error. It says it cannot access the file ....
\Archive\Log File-2\23.

It appears as if it is treating the slashes in the date
as directory paths ... Any ideas?

Thanks,
Mike.

-----Original Message-----
"Log file-" & Date

--
Regards;
Rob
---------------------------------------------------------

---------------
"Mike" wrote in

message
...
Hi. I would like to have the current date saved in the
filename when the macro is excercised.

For instance, the filename is "Log File.xls". I would
like a command that, if executed on February 23, it

would
save the filename "Log File - 2/23/04.xls.

My current command is:

ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path
& "\Archive\" & "Log File"

What should I add to this command to include the date?

Thanks,
Mike.



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
RWN RWN is offline
external usenet poster
 
Posts: 104
Default Save date in filename

Oops, it's past my bedtime!

Paul is correct, and my only excuse is that my date separator is set up
as a dash, so out of habit I ignored the slash in your example.

Sorry for the confusion.

--
Regards;
Rob
------------------------------------------------------------------------
"Mike" wrote in message
...
Rob:

Thanks for your reply. When I try this, I get a run time
error. It says it cannot access the file ....
\Archive\Log File-2\23.

It appears as if it is treating the slashes in the date
as directory paths ... Any ideas?

Thanks,
Mike.

-----Original Message-----
"Log file-" & Date

--
Regards;
Rob
---------------------------------------------------------

---------------
"Mike" wrote in

message
...
Hi. I would like to have the current date saved in the
filename when the macro is excercised.

For instance, the filename is "Log File.xls". I would
like a command that, if executed on February 23, it

would
save the filename "Log File - 2/23/04.xls.

My current command is:

ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path
& "\Archive\" & "Log File"

What should I add to this command to include the date?

Thanks,
Mike.



.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Save date in filename

ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path
& "\Archive\" & "Log File " & format(date,"mmddyy") & ".xls"

Or one of the combinations below to start.

format(date,"mmm dd yyyy")
format(date,"mm dd yy")
format(date,"mm dd yyyy")

When I append dates, I don't fool around with backslashes or slashes.

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------

Hi. I would like to have the current date saved in the
filename when the macro is excercised.

For instance, the filename is "Log File.xls". I would
like a command that, if executed on February 23, it would
save the filename "Log File - 2/23/04.xls.

My current command is:

ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path
& "\Archive\" & "Log File"

What should I add to this command to include the date?

Thanks,
Mike.


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
Cell("filename") doesn't update to new filename when do save as. Louis Excel Worksheet Functions 2 March 22nd 07 07:27 PM
set filename to <filename-date on open bob engler Excel Worksheet Functions 2 July 13th 06 05:11 AM
Save as .htm with filename from cell galimi Excel Discussion (Misc queries) 1 May 13th 05 04:51 AM
Disabling Macros After A Save To A Different Filename R3df1sh[_2_] Excel Programming 2 November 14th 03 12:00 PM
Save Filename+Date+Time? Scooby912 Excel Programming 1 July 25th 03 06:21 PM


All times are GMT +1. The time now is 07:20 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"