Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to save Excel file with date and time in the file name?

Does someone out there have a macro that when executed would save the current
Excel spreadsheet in the form "filename-current date-current time.xls" and
leave the file open for editing? Ideally, I would like to pin the macro to a
button on the user's toolbar. Thank you for you help in advance.
Troy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Macro to save Excel file with date and time in the file name?


With Activeworkbook
.SaveAs .Filename & "-" & Format(Now,"dd-mmm-yyyy-hh-mm-ss")
End With

--

HTH

RP
(remove nothere from the email address if mailing direct)


"sonic_d_hog" wrote in message
...
Does someone out there have a macro that when executed would save the

current
Excel spreadsheet in the form "filename-current date-current time.xls" and
leave the file open for editing? Ideally, I would like to pin the macro

to a
button on the user's toolbar. Thank you for you help in advance.
Troy



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Macro to save Excel file with date and time in the file name?

"sonic_d_hog" wrote in message
...
Does someone out there have a macro that when executed would save the
current
Excel spreadsheet in the form "filename-current date-current time.xls" and
leave the file open for editing? Ideally, I would like to pin the macro
to a
button on the user's toolbar. Thank you for you help in advance.
Troy


If you already have a file named Xxxxxx-date-time.xls:

=========================
Public Sub SaveAsDateTime()

With ActiveWorkbook
.SaveAs Left(ActiveWorkbook.FullName, _
InStr(1, ActiveWorkbook.FullName, "-")) _
& Format(Now, "yyyymmdd-hhmmss") & ".xls"
End With

End Sub
=========================

Ciao
Bruno


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
customer date time save file Robert Loxley Excel Discussion (Misc queries) 0 October 30th 06 05:36 PM
Save File with Date and Time Stamp Andibevan[_3_] Excel Programming 9 May 4th 06 01:17 AM
Save File with the current date and time. sd Excel Programming 2 December 2nd 05 12:33 PM
Save file with time date stamp oberon.black[_91_] Excel Programming 1 September 22nd 05 01:13 AM
Macro needed; save a file two (or more places) at the same time Sigurd Excel Programming 3 March 2nd 04 11:20 PM


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