VBA & Macro Problems

How to Fix Excel Macros Disappearing After Saving a Workbook

Steven ParkerSteven Parker Oct 23, 2026 869 views

Question details

The user's Excel macros are missing or have disappeared after saving and reopening a workbook.

How to Fix Excel Macros Disappearing After Saving a Workbook
Product
Microsoft Excel
Device & OS
not provided
Scenario
Saving and subsequently reopening an Excel workbook containing VBA macros.
Observed behavior
The VBA macros previously written or recorded in the workbook are no longer visible or accessible, potentially due to wrong file format, corruption, or security settings.
Before you start

Before attempting to recover your macros, create a duplicate copy of the affected workbook to ensure you do not accidentally overwrite any remaining recoverable VBA code during troubleshooting.

Solution 1Recommended

Verify the Workbook is Saved in a Macro-Enabled Format

Macros cannot be saved in the default .xlsx format. You must ensure the file was saved as an .xlsm or .xlsb.

The most common reason macros disappear is that the workbook was inadvertently saved as a standard Excel Document (.xlsx). This file type automatically strips all VBA code to ensure security.

1
Check the file extension

Locate your workbook in Windows File Explorer or Mac Finder. Check if the file extension is .xlsm (Excel Macro-Enabled Workbook) or .xlsb (Excel Binary Workbook).

2
Save as macro-enabled

If you are actively editing and still have the macros loaded in your current session, go to 'File' > 'Save As'. In the file format dropdown, specifically select 'Excel Macro-Enabled Workbook (*.xlsm)'.

Format Warning: If you have already saved the file as .xlsx and closed the application, the macros are permanently deleted from that specific file. You will need to rely on a backup.
Free Microsoft Office alternative

Try WPS Office for Seamless Spreadsheet Management

Tired of macro errors, missing features, and file corruption in Microsoft Excel? WPS Office offers a free, lightweight, and highly compatible alternative. Enjoy seamless support for standard spreadsheet formats, a familiar user interface, and an efficient environment for all your data processing needs.

  1. 1. Download WPS Office: Visit the official WPS website and download the free installer for your operating system.
  2. 2. Install the Software: Run the installer and follow the simple on-screen instructions to set up the lightweight office suite.
  3. 3. Open Your Spreadsheets: Launch WPS Spreadsheet and open your existing Excel files directly with perfect format compatibility.
Fully compatible with Microsoft Excel formats including .xlsx, .xls, and .csv.Familiar user interface ensures zero learning curve when migrating.Lightweight installation with fast loading times and smooth performance.Built-in file protection and backup features to prevent accidental data loss.
microsoft office alternative - wps office

Frequently Asked Questions

Why do my Excel macros keep disappearing when I save?

This usually happens if you save your workbook in the standard .xlsx format. The .xlsx format cannot store VBA code by design. You must always choose .xlsm or .xlsb from the 'Save As' dropdown when saving a workbook containing macros.

Can I recover macros if I accidentally saved the file as .xlsx and closed it?

Once an .xlsx file is saved and the Excel application is closed, the macros are permanently removed from that file. Your only option is to recover a previous version via OneDrive Version History, Windows File History, or Excel's AutoRecover feature.

Why is my VBA project completely empty even though it is saved as an .xlsm file?

This can occur due to file corruption, aggressive antivirus software deleting the macro scripts, or third-party add-ins blocking the VBA project from loading. Try opening the workbook in Excel Safe Mode (hold the Ctrl key while launching Excel) to see if the VBA project loads.