I'm working on an Add-In/Reference in excel VBA. At the top of the Add-In I want to put a function which backs-up and saves the add-in. I've coded the following, but keep getting the error "Code execution has been interrupted" on the "End Sub" line:
Sub SaveEditsToAddIn()
DateAndTime = Format(Now, "yyyymmdd-hhmmss")
Dim xlobj As Object
Set xlobj = CreateObject("Scripting.FileSystemObject")
xlobj.CopyFile "c:\File.xlam", "c:\backup\File " & DateAndTime & ".xlam", True
Set xlobj = Nothing
ThisWorkbook.Save
End Sub