An Excel VBA Addin is running the following code in a regular module, modifying another workbook referenced as ActiveWorkBook, which contains a sheet called "Master List".
Whether the code makes it to MsgBox "2" or not depends whether macros are enabled in ActiveWorkBook (not the Addin)! If Macros are not enabled, it prints a "0" and then stops. I know it's made a copy because I see "Master List (2)" as a sheet. But it does not output "1". If Macros are enabled (either with a user permission, or perhaps the ActiveWorkBook is in a trusted folder) the code proceeds through MsgBox "2" and beyond. What's going on??? The sheet Master List does contain events code, if that helps. On the other hand I've turned events off.
Application.EnableEvents = False
With ActiveWorkbook
.Worksheets("Master List").Unprotect "XXX"
MsgBox "0"
.Worksheets("Master List").Copy After:=.Worksheets(1)
MsgBox "1"
.ActiveSheet.Name = "OldMasterList"
MsgBox "2"