Make back up of excel using macro

Closed
ujo Posts 8 Registration date Wednesday 15 July 2009 Status Member Last seen 23 September 2009 - 5 Sep 2009 à 00:15
venkat1926 Posts 1863 Registration date Sunday 14 June 2009 Status Contributor Last seen 7 August 2021 - 6 Sep 2009 à 21:15
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 14 June 2009 Status Contributor Last seen 7 August 2021 811
6 Sep 2009 à 21:15
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