Backup Active Workbook Using a Macro

dgr

Board Regular
Joined
Apr 24, 2005
Messages
176
Hello,
I'm using Excel 2013. I want to backup my active workbook to another destination. I'm trying to use the following code but it says <b>Runtime Error 70 permission denied</b>. Is there any other way to to backup my active workbook without having to use SaveAs?

Thank.

My code:
Code:
Sub backup_xlsm_file()
Dim SourceFile, DestinationFile

SourceFile = "E:\path1\Book1.xlsm"
DestinationFile = "E:\path2\Book1" & Format(Now(), "yyyy_mmdd") & ".xlsm"
FileCopy SourceFile, DestinationFile
end sub
 
Thanks for your reply, John. Unfortunately, this did not work either. The macro ran successful & there was no error message. However, the backup file did not materialize too. My code;
Code:
ThisWorkbook.SaveCopyAs DestinationFile = "C:\Users\myself\Desktop\Book1" & Format(Now(), "yyyy_mmdd") & ".xlsm"
I'm very sure the path exists.
 
Upvote 0

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