View Single Post
  #5   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming
PR[_3_] PR[_3_] is offline
external usenet poster
 
Posts: 7
Default name a backup file

Tom,
I have just realised that I cannot save it just by the month, so I wish to
save the date and time, I have tried to use this:
.SaveCopyAs Left(.FullName, Len(.FullName) - 4) & "_backup_" &
Format(Now, "dd Mmm yy h:mm") & ".xls"
but I get an error, can you please tell me why.

Paul

"Tom Ogilvy" wrote in message
...
change this:

ActiveWorkbook.SaveAs Filename:="D:\Last Months.xls", FileFormat:= _
xlExcel9795, Password:="", WriteResPassword:="",
ReadOnlyRecommended:= _
False, CreateBackup:=True


to

'Silently overwrite any existing file with this name
Application.DisplayAlerts = False
With ActiveWorkbook
.SavecopyAs "D:\Last Months.xls"
End With
Application.DisplayAlerts = True

--
Regards,
Tom Ogilvy


"PR" wrote in message
...
Tom,
thanks for this, how do I put into this part of the code:

ActiveWorkbook.SaveAs Filename:="D:\Last Months.xls",
FileFormat:=

_
xlExcel9795, Password:="", WriteResPassword:="",
ReadOnlyRecommended:= _
False, CreateBackup:=True

"Tom Ogilvy" wrote in message
...
With ActiveWorkbook
.SavecopyAs Left(.Fullname,len(.FullName)-4) & "_backup_" & _
format(date,"mmm") & ".xls"
End With

--
Regards,
Tom Ogilvy


"PR" wrote in message
...
I am trying to create a backup copy of a current spreadsheet, and I

want
to
call it a backup copy and place the month in the title of the file.

Can anyone help me achieve this.

PR