Save Backup Workbook With Macro

Twollaston

Board Regular
Joined
May 24, 2019
Messages
241
Hello there,

I'm trying to find a macro that I can add to my quick access toolbar to be able to save the file as, with the current file name and the date and time added.
to this path
C:\Users\wwollaston\Documents\Files\Backups\


For Example,

I'm in a workbook named Workbook1 and I run the macro, now I should have a file saved here
C:\Users\wwollaston\Documents\Files\Backups\Workbook1 8.6.2019 3:32PM.xlsx
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Does this work? You can't have : in a file name, so the time is separated by a period.

Code:
Sub Backup()
Dim path As String: path = "C:\Users\wwollaston\Documents\Files\Backups\"
ThisWorkbook.SaveAs path & "Workbook1 " & Format(Now(), "m.d.yyyy h.nn am/pm") & ".xlsm", xlOpenXMLWorkbookMacroEnabled
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,264
Members
452,627
Latest member
KitkatToby

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