Forum Discussion
Ellis645
Nov 11, 2019Copper Contributor
Excel Automation Error and VBA Module Duplication
A recently stable Excel package became dramatically unstable about a week ago, after minor revisions, with numerous errors including Automation Error and duplication of all VBA modules. I opened it i...
JKPieterse
Nov 11, 2019Silver Contributor
This is usually an indication the VBA project has become corrupted. One example of when this sometimes happens is if you are debugging a VBA project which contains User Defined Functions called from cells. If you save the file while in debug mode this sometimes happens in my experience. There might be several ways to get out of this state, one being exporting all VBA modules, then saving as xlsx file, closing and re-opening the xlsx, importing the VBA modules and then saving as xlsm.
- Ellis645Nov 11, 2019Copper Contributor
Thanks Jan. That is probably what happened - yes, I was debugging and maybe save before the process was complete. To clarify, after exporting and saving as XLSX, do I need to remove the old modules or just import over them? Also, would saving in Safe Mode automatically do the same thing, or similar, by editing the corrupted code?
- JKPieterseNov 11, 2019Silver ContributorIf you FIRST close the newly saved xlsx and then reopen it, all VBA will have been removed from it (INCLUDING code in sheet modules and in ThisWorkbook, so you may want to check those too before closing the xlsx!).
Saving in safe mode is no different from saving in "normal" mode.- Ellis645Nov 11, 2019Copper Contributor
Ah, the modules are gone after saving as xlsx. I see. And they have now been re-imported.
Also re-imported forms. These exported from other version in two types, FRM and FRX. Will investigate these, but they imported successfully. Thank you for the instructions. I should be okay from here.