Backup copy of workbook macro

andrewb90

Well-known Member
Joined
Dec 16, 2009
Messages
1,077
Hello,

I am using this code to create a backup copy of my workbook:
Code:
Sub DOUGHMON()Dim fname
fname = "C:\Users\Andrew\Desktop\WEEKLY SALES REPORTS\" & Format(Now, "dd mmm yy") & ".xlsm"
ThisWorkbook.SaveAs Filename:=fname
End Sub
The only problem with this code is that my current file gets closed and the backup is open. I'm not sure if that is exactly what happens, but when it is done the current file that is open is the copy, and I would like the original file to stay open.

Thanks,

Andrew
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
to make a copy of your workbook use SaveCopyAs

Code:
ThisWorkbook.SaveCopyAs Filename:=fname

Dave
 
Upvote 0

Forum statistics

Threads
1,215,050
Messages
6,122,868
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top