Make back up of excel using macro

Closed
ujo Posts 8 Registration date Wednesday July 15, 2009 Status Member Last seen September 23, 2009 - Sep 5, 2009 at 12:15 AM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Sep 6, 2009 at 09:15 PM
Hello,
I am working on excel file ABC.xls. While the file is still open I want to run a macro which will make a copy of the current ABC.xls as Backup ABC (current date&time).xls and save it in the same folder and then I can continue to work on ABC.xls. I tried following code for a macro, but it did not work. I ran the macro from ABC.xls. I am going to use it in an excel based application that I am developing.
Related:

1 response

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Sep 6, 2009 at 09:15 PM
try this macro

sub test()
Dim fname
fname = "d:\excel\ABC " & Format(Now, "dd mmm yy hh mm") & ".xls"
ThisWorkbook.SaveAs Filename:=fname
End Sub



the path D:\excell
is only an example folder. change it to your folder
0