Workbook with macro crasheds Excel 2016 if it is a Trusted Document

Copper Contributor

Hello all,

 

I have run into a strange issue where we have a workbook with macros in it that has worked in Excel 2007 without issue.  

 

Upon moving to Excel 2016, the workook is fine if the user manually Enables Content each time the workbook is opened.  

 

But if we make it a Trusted Document, Excel will crash giving the "Excel has stopped working...." error message.  It crashes on exit every time and will also crash sporadically at other seemingly random times if the workbook is left open.

 

Why would making it a Trusted Document make any difference from Enabling Content manually?

1 Reply

Enabling content manually allows Excel to do processing before your code is run.
The Workbook_Open event sometimes may get triggered before Excel is finished with its housekeeping work (especially if a file is double-clicked from Explorer and Excel hasn't loaded at that time). One way around this is to postpone any workbook_open handling by moving the code in there to a sub in a normal module and scheduling that macro in Workbook_Open using Application.OnTime. That allows for Excel to finish all its startup work before the scheduled code is called.