Make back up of excel using macro [Closed]

Report
Posts
8
Registration date
Wednesday July 15, 2009
Status
Member
Last seen
September 23, 2009
-
Posts
1862
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
July 30, 2015
-
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.

1 reply

Posts
1862
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
July 30, 2015
795
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

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!