Excel crashes when enabling macros
I’ve had a problem with Excel 2013 crashing a number of times when opening/editing spreadsheets with macros. When I click ‘Enable Content’ to enable macros, the Excel window fades out, goes unresponsive and then crashes with a glorious “Microsoft Excel has stopped working, Windows is checking for a solution to the problem” message. Unfortunately Windows never seems to be able to find the elusive solution that we need.
I’ve found that the spreadsheets tend to stay working whilst you’re looking at them (if you don’t click ‘Enable Content’), however it crashes when you try and do anything useful such as copy/paste, etc. Sometimes Excel just crashes when opening the file, even without enabling macros. This is seemingly caused by a corrupt compile of the macros. Yes I know it’s VBA code which is interpreted and not compiled, but I’m over-simplifying here.
There a a couple of solutions to this:
1) Before enabling the macros try adding a new blank sheet, and then save the spreadsheet, reload, and sometimes it corrects itself. But not always.
2) Recompile the macro
- Open the Excel spreadsheet (but don’t enable macros yet)
- In the ‘Developer’ ribbon, click ‘Visual Basic’
- On the ‘Tools’ menu, click ‘Options’
- Then on the ‘General’ tab, untick ‘Compile On Demand’, then click OK
- Then scroll down in the ‘Project’ window, right click on ‘Modules’, then Insert a new module
- Then just close the Visual Basic window, save the spreadsheet and close Excel.
- Hey presto, when you then load your spreadsheet you’ll be able to enable macros, and Excel won’t crash.
Thanks to Paulina from Microsoft for helping me find this solution – it’s saved my bacon a few times now!