#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Save As

How would I go about saving a workbook to another name that contains the
date and time? Let's say the original file is called "Book." What I
would like to do is have a macro that saves "Book" as "Book-yy-mm-dd-hh-mm"
Any suggestions?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Save As

One way:

Option Explicit
Sub testme01()

Dim myName As String

With ActiveWorkbook
myName = .Name

myName = Application.Substitute(LCase(myName), ".xls", "") & _
"_" & Format(Now, "yyyy-mm-dd-hh-mm")


.SaveAs Filename:=.Path & "\" & myName

'.SaveCopyAs Filename:=.Path & "\" & myName
End With

End Sub

Take a look at .savecopyas in VBA's help. You'll see that it makes a backup of
the file without saving the current file--or changing its name. (It may be
useful--one day?)

Orf Bartrop wrote:

How would I go about saving a workbook to another name that contains the
date and time? Let's say the original file is called "Book." What I
would like to do is have a macro that saves "Book" as "Book-yy-mm-dd-hh-mm"
Any suggestions?


--

Dave Peterson

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
Save, save as, page setup dimmed out in unprotected excel sheet? ccKeithJ Excel Discussion (Misc queries) 3 December 14th 07 07:07 PM
how to get disk icon on save button of save as dialog like 2000 RichT Excel Discussion (Misc queries) 2 March 9th 06 08:13 PM
Save Excel file - prompts to save - no Volitile functions used POWER CERTS Excel Worksheet Functions 2 November 1st 04 09:27 PM
Why system asks me to save change even after I call save method(VB.NET) steellock Excel Programming 2 April 27th 04 04:14 AM
Save As - Multiple Sheets fails to save as text file Ravee Srinivasan Excel Programming 2 November 10th 03 04:05 PM


All times are GMT +1. The time now is 09:33 AM.

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

About Us

"It's about Microsoft Excel"