XL2010/ Workbook_Open() event fails when opening a workbook in protected view and then clicking "Enable Editing"


Symptom


  • You have the Trust Center Macro settings in Excel 2010 set to: "Enable all macros (not recommended; potentially dangerous code can run)"
  • You open a macro enabled workbook in Excel 2010 that opens in Protected View, for example by opening the workbook from an email message.
  • The workbook has VBA code in the Workbook_Open event.
  • You click the "Enable Editing" button, you may receive a run-time error or you may get unexpected results from the macro.
 

Cause


If you have your Macro Settings set to "Enable all Macros" the Workbook_Open() event is triggered before Excel has exited from the Protected View workbook and opened the workbook enabled for editing.

Resolution


Change your Macro Settings in the Trust Center to "Disable all macros with notification". This allows Excel to open the workbook enabled for editing before the user chooses to allow macros to run through the Trust Bar.

More Information


Microsoft is aware of this problem.

Microsoft does not recommend disabling "Protected View".