Backup with date-time
Does this work
Sub Save_Workbook()
Application.DisplayAlerts = False
With ActiveWorkbook.
SaveCopyAs FileName:= "c:\temp\" & _
Left(.Name, InStr(1, LCase(ThisWorkbook.Name), ".xls") - 1) & _
Format(Now, "mmddyyhhmmAMPM") & ".xls"
End With
Application.Display = True
End Sub
--
HTH
RP
(remove nothere from the email address if mailing direct)
"appeng" wrote in message
...
I am using MS Excel 97 and trying to save a backup copy of files, with
date
and time saved, to a specific directory while maintaining the original
file
name for the active workbook. For example
Original workbook 1 name = c:\data\schedule.xls
Original workbook 2 name = c:\data\data.xls
When saved, save a copy in c:\temp
With file name schedule NOV0504 623AM.xls
Or data NOV404 703PM.xls
The original file would remain
c:\data\schedule.xls and c:\data\data.xls
I have tried the following but cannot get it to work
Sub Save_Workbook()
Application.DisplayAlerts = False
ActiveWorkbook.SaveCopyAs FileName:= _
"c:\temp\" & _
Left(ThisWorkbook.Name, InStr(1, LCase(ThisWorkbook.Name), ".xls") - 1) _
& Format(Date, "mmddyy") & Format(Date, "hhmmAMPM") & ".xls"
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Application.DisplayAlerts = True
End Sub
I am sure I am missing something simple. Any suggestions?
|