Forum Discussion
Remove "Ghost" Excel sheet object from VBA
- Apr 03, 2025
After trying many methods that did not work from CoPilot and other AI engines, the easiest method was to export all the modules, userforms, and sheets to remove these "Ghost objects". There appears to be a more time consuming and complicated method to manually edit the binary code directly in the VBA project structure.
It appears that it is not "corrupt" per se but some how the codename (CAD2) is somewhere in the project structure.
I was successful exporting all the modules, userforms and sheets and then transferred all to a new Excel file to save. The ghost files are gone. Not everything transfers. I had some "buttons" that referenced macros that looked for the previous version name, so you have to be careful to name the project the same name or edit those buttons references macros.
Note that the icon of the ghost sheets is that of the ThisWorkbook object. This is usually a sign that the workbook is corrupt.
Possible solution:
- Export all VBA code.
- Save the workbook as a .xlsx workbook (this will remove all VBA code).
- Import the VBA code.
- Save as a .xlsm workbook.
Or:
- Copy all real worksheets and all modules to a new workbook.
- jhammonsApr 03, 2025Copper Contributor
After trying many methods that did not work from CoPilot and other AI engines, the easiest method was to export all the modules, userforms, and sheets to remove these "Ghost objects". There appears to be a more time consuming and complicated method to manually edit the binary code directly in the VBA project structure.
It appears that it is not "corrupt" per se but some how the codename (CAD2) is somewhere in the project structure.
I was successful exporting all the modules, userforms and sheets and then transferred all to a new Excel file to save. The ghost files are gone. Not everything transfers. I had some "buttons" that referenced macros that looked for the previous version name, so you have to be careful to name the project the same name or edit those buttons references macros.