0

Apologies if this question is a little vague - but I am struggling to find relevant information on the 'Automation Error - Catastrophic Failure' I am experiencing.

The code I have written is set to run when the workbook is open. The code appears so run as intended, with no errors. I have stepped through the code and checked it and I can't see any obvious problems or anything that is not behaving as it should.

The 'Automation Error - Catastrophic Failure' only occurs when I click the Visual Basic Editor on the excel tool bar.

The section of code is quite long so its not really feasible to paste it here, but I only get the error once when opening the editor, and then it does't appear again.

I'm not even sure where to start in debugging this or what this error exactly means in this instance? Any input would be greatly appreciated!

hsquared
  • 349
  • 2
  • 4
  • 17
  • possible duplicate of: https://stackoverflow.com/questions/31888880/automation-error-catastrophic-failure-excel-vba – Rno Sep 27 '18 at 15:11
  • 1
    Not a duplicate. It's not throwing the error when opening. Its running fine on opening and only throwing the error once when trying to open the editor. That other question doesn't actually provide an answer, either. – hsquared Sep 27 '18 at 15:12
  • Did you change environment? For example the initial code was developed on another PC / With another version of Office? – Vincent G Sep 27 '18 at 15:20
  • @VincentG Nope, It was done on the same computer & same version of office. – hsquared Sep 27 '18 at 15:23
  • Do you have any VBE add-ins loaded? Disable them all if you do, then close everything (not just the VBE window) and reopen Excel, then re-enable add-ins one by one. – Mathieu Guindon Sep 27 '18 at 15:44
  • How do you step through the code if bringing up the VBE blows up? Does Alt+F11 do the same thing? – Mathieu Guindon Sep 27 '18 at 15:45
  • @MathieuGuindon This is what I don't understand - The error appears when I press the 'Visual Basic' editor button. After pressing okay it then opens the editor and behaves as normal. - I'm not quite understanding what the error is meaning because nothing else seems to happen and I can't duplicate the error again until I close the workbook and open the editor it again. – hsquared Sep 27 '18 at 15:48
  • Ok so the "catastrophic failure" doesn't shut everything down. Do you have any VBE add-ins loaded? – Mathieu Guindon Sep 27 '18 at 15:49
  • @MathieuGuindon No it doesn't close anything - It doesn't appear to do anything really? I also don't have any add-ins loaded either. (I haven't come across this before so I'm not sure exactly what was meant to happen, but Catastrophic Error sounds serious!) – hsquared Sep 27 '18 at 15:50
  • 2
    Ok so no add-ins rule out a VBE add-in failure, which means the problem is with your code... which means your question is unanswerable. Start a separate instance of Excel with a brand new workbook, bring up the VBE, add the original code back in bit by bit until the issue is reproduced. If all the code is in and the problem is still not reproduced, something is corrupted with the original workbook. – Mathieu Guindon Sep 27 '18 at 15:53
  • @MathieuGuindon okay - thanks for your help. Any idea why the code would run though and only cause the error when opening the editor? I would have expected this when it was opening when all the code would have been executed? – hsquared Sep 27 '18 at 15:56
  • No idea, no. I mean, I've exhausted them all, above. – Mathieu Guindon Sep 27 '18 at 15:57
  • It's possible that the issue is caused by extracting the source code from the project binary - that would also partially explain the "solution" in the comments from the linked question above. If you force a *complete* recompile (make some change in every module) and it persists, there's something in your code that the VBE is having problems with. – Comintern Sep 27 '18 at 16:31
  • 1
    I wouldn't worry excessively about 'Catastrophic failure' errors... Office tends to throw these when it doesn't know what happened. I ran across this once when attempting to reference a table in Word when there wasn't one :) – seadoggie01 Sep 27 '18 at 18:46
  • I just noticed something. After this error occurred, I clicked "OK", and attempted to re-open the VBA editor. Upon opening, and looking at the projects listed, I noticed that some projects were listed for files that I don't even have open--and, in fact, the project relating to the most recently opened Excel file was active, not the project relating to the currently opened file. I feel that the project list (and/or active project) not updating properly could be the issue. Why this is occurring, however, I'm unsure. – d4rk_1nf1n1ty Jun 18 '19 at 18:24

0 Answers0