I was wondering if anyone has encountered this and found a workaround in Applescript. I have a script that autogenerates an Excel spreadsheet (using Excel 2011) by pasting formulas and inserting images, etc… into my Excel file. One problem I’m encountering is that my Applescript is crashing because Excel crashes. So to compensate for the random crashing of either Excel or my Applescript I wrote another script that is launched every 30 seconds using launchd that monitors the CPU usage of my Excel script. If it sees the CPU usage <=0.1 then I know that Excel or my Excel script has died so I kill the Excel process and my Excel Script process and restart them. This is all working fine has well with the exception of one scenario where Excel is trying to do Auto Recovery when it restarts and it’s prompting me “Excel saved changes to the file before the application quit unexpectedly. Do you want to open the last saved version of this file?” I can either click on Cancel or Open.
I’ve tried to minimize Excel crashing in the first place by putting in some delays in my script and that has helped somewhat but Excel still seems to crash as my Excel script is pretty big and doing a lot of pasting and generating formulas.
I’ve tried setting the Preferences in Excel to not do Auto Recovery but it doesn’t seem to work. Once in a while I still get the prompt by Excel. Anyone know how to bypass this prompt within Excel when it starts up so my Excel script can continue? Or the best way to handle this prompt and click on cancel?