Hi,
I'm am extremely green using VBA. I was able to find info on creating a macro in VBA that would save a copy of my workbook to another location, as a backup; and I was able to modify where I wanted to save it. I linked this macro to a Button in my work book.
What I am looking for is, instead of clicking the button, can I add some code so that the macro runs when I hit the 'X' button to close excel?
I'm am extremely green using VBA. I was able to find info on creating a macro in VBA that would save a copy of my workbook to another location, as a backup; and I was able to modify where I wanted to save it. I linked this macro to a Button in my work book.
What I am looking for is, instead of clicking the button, can I add some code so that the macro runs when I hit the 'X' button to close excel?
VBA Code:
Sub Backup_Files()
ActiveWorkbook.SaveCopyAs "D:\Time Sheets\BackUp_" + ActiveWorkbook.Name
End Sub