How to Remove Hidden Macros or VBA Modules from an Excel Workbook
Question details
The user needs to permanently remove hidden macros or empty VBA modules from an Excel workbook to clean up the file and restore features like AutoSave.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Eliminating all VBA content from a workbook when no macro procedures are visibly listed in the standard Macros dialog box.
- Observed behavior
- The workbook retains hidden VBA modules or lingering project data, preventing AutoSave from functioning and unnecessarily triggering macro warnings.
Before stripping macros from your workbook, verify that no automated tasks or custom functions rely on the VBA code. It is highly recommended to save a backup copy of your original macro-enabled (.xlsm or .xlsb) file.
Save the File as a Standard Excel Workbook (.xlsx)
The fastest and most reliable way to remove all VBA code and macro modules from a workbook is to save it in a macro-free format.
By saving your workbook as a standard .xlsx file, Excel automatically strips out all VBA projects, macros, and ActiveX controls while preserving your data, charts, and formulas.
Click on the 'File' tab in the top ribbon and select 'Save As'.
In the 'Save as type' drop-down menu, select 'Excel Workbook (*.xlsx)'.
Click 'Save'. A warning dialog will appear stating that VB projects cannot be saved in macro-free workbooks. Click 'Yes' to confirm the removal of the macros.
Close the current file and open the newly saved .xlsx file. It is now completely free of VBA content.

Manually Remove Modules via the Visual Basic Editor
Use this method if you need to keep the workbook in a macro-enabled format (.xlsm) but want to delete specific, hidden, or empty VBA modules.
Easily Strip Unwanted Macros using WPS Spreadsheet
WPS Office provides robust spreadsheet tools that handle macro-enabled files seamlessly. You can easily strip unwanted macros by saving your files in a macro-free format using WPS Spreadsheet.
- 1. Open Your Workbook: Launch WPS Spreadsheet and open your macro-enabled workbook.
- 2. Navigate to Save As: Click on the 'Menu' button in the top left corner and choose 'Save As'.
- 3. Select Macro-Free Format: Select 'Excel Workbook (*.xlsx)' from the file type drop-down list.
- 4. Save and Remove Macros: Click 'Save' and confirm the prompt to permanently remove the macro project from the new file.

Frequently Asked Questions
Why do I get a macro warning when there are no macros listed in the Macros dialog?
Your workbook likely contains empty VBA modules, class modules, or leftover code in the background (such as Worksheet_Change events). Even completely empty modules can trigger macro security warnings. You must delete these modules in the VBA Editor to stop the warnings.
Will saving my file as an XLSX delete my formulas or formatting?
No. Saving a file as a Standard Excel Workbook (.xlsx) will only remove VBA code, macros, and ActiveX controls. Your formulas, cell data, charts, and standard formatting will remain completely intact.
How do I view hidden macros if the Developer tab is disabled on my ribbon?
You do not need the Developer tab to access the backend code. You can bypass the ribbon entirely by pressing Alt + F11 on your keyboard to directly launch the Visual Basic Editor, where all modules and macros are visible.




