Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Save, save as, page setup dimmed out in unprotected excel sheet? | Excel Discussion (Misc queries) | |||
how to get disk icon on save button of save as dialog like 2000 | Excel Discussion (Misc queries) | |||
Save Excel file - prompts to save - no Volitile functions used | Excel Worksheet Functions | |||
Why system asks me to save change even after I call save method(VB.NET) | Excel Programming | |||
Save As - Multiple Sheets fails to save as text file | Excel Programming |