Automation Error message when trying to run Excel 2010 VBA macros

1

In the last few weeks, when I have tried to run any VBA macro in most situations, I get messages that "Microsoft Excel has stopped working" and "Microsoft Excel is trying to recover your information". When the second message appears, I also get an error message "Automation Error", helpfully behind the Excel window. This shows no error number, though clicking on Help reveals that it is Error 440. The accompanying Help text implies that it is to do with incorrect code setting objects. But the errors are coming up the moment I hit the Run (or even Step) button.

Amazingly enough, if I edit the code, even by putting in or removing a blank line (and even without saving the change), the macro can be executed. So it does not seem to be errors in the code itself.

If the macro is fairly simple and does not do much, I can usually run the next macro. However, if it does a substantial amount of processing I am back where I started. As I won't have reopened Excel between it running and then not running, it seems unlikely to relate to Excel startup issues.

The problem applies when trying to run all VBA macros in Excel 2010, even simple or dummy ones, and even macros which had not been edited for months or even years. It is as if the VBA code is not closing down or releasing something properly.

As it seemed to start after various Office updates from Microsoft, I tried uninstalling the recent ones but this does not seem to have worked. I have tried opening Excel in safe mode - no difference.

VBA macros in Access 2010 do not seem to be affected. Nor are those in Excel 2003, which I still use for some tasks.

I am using Windows 7 SP2 64-bit. The computer is six years old but good enough spec for Windows 10. I am having problems with minute-long freezes in IE (which may be Flash-related judging from Event Viewer) and occasional crashing of the graphics card but these seem unlikely to be related.

Event viewer invariably tells me...

Faulting Application name: EXCEL.EXE, version 14.0.7168.5000...
Faulting module name: EXCEL.EXE, version 14.0.7168.5000...
Exception code: 0xc0000005
Fault offset: 0x004ef40d

The rest varies of course. Event ID is shown as 1000.

I have trawled the internet for any references to automation error messages with this specific impact but no luck. I have also scanned with Avast and MalwareBytes and not found anything worrying. Has anyone got any ideas please?

vba
excel-vba
excel-2010
excel
asked on Stack Overflow Jun 9, 2016 by Michael C • edited Jul 9, 2018 by Community

1 Answer

0

I had VBA code running in Excel that was activated from Access and kept getting 440 Automation Error. I removed the 'End' statement, which was used from an Excel form to stop the code, and all is good now when running the Excel code from Access.

answered on Stack Overflow Apr 5, 2019 by James England

User contributions licensed under CC BY-SA 3.0