Excel VBA Project has generated multiple Workbook objects
Here is my solution, it works consistently and you don't need to manually copy the sheets and code across to a blank workbook. I've tested this method on several corrupted workbooks that were giving me the "Automation error - Catastrophic failure" error upon launch.
NOTE: Original corrupted file was saved as .xlsm
- Open a blank Excel workbook
- Developer tab > Macro security > Disable all macros without notification
- Close Excel
- Double-click corrupted file, for example, MyFile.xlsm
- File > Save as... > MyFile.xlsb (not .xlsm), choosing the .xlsb format is what does the trick
- Developer tab > Macro security > Enable all macros (or whatever level of security you prefer)
- Close Excel
- Double-click MyFile.xlsb
The file is now fixed! You can re-save the MyFile.xlsb file as .xlsm if required. In my experience .xlsm files become corrupted quite easily, so I'm going to get into the habit of always using the .xlsb format.
Hope somebody finds this helpful :)