VBA & Macro Problems

How to Fix Excel Not Saving or Running Macros

Natalie TaylorNatalie Taylor Nov 10, 2026 871 views

Question details

The user is unable to save or execute macros (VBA code) in their Excel workbook.

How to Fix Excel Not Saving or Running Macros
Product
Excel
Device & OS
not provided
Scenario
Saving an Excel workbook with custom VBA code or attempting to run an existing macro.
Observed behavior
Macros are lost after saving and reopening the document, or VBA code fails to execute because standard workbook formats do not retain them.
Before you start

Ensure you have the original VBA code available in case it was stripped during a previous save. Also, verify that your organization's security policies allow the execution of macros.

Solution 1Recommended

Save the File as an Excel Macro-Enabled Workbook (.xlsm)

Excel's default .xlsx format cannot store VBA macros. You must use the .xlsm format to retain your code upon saving.

By default, Excel saves files in the .xlsx format, which is a macro-free format. If you write VBA code and save the file as an .xlsx, Excel will automatically remove the macros to maintain security standards. Saving as an .xlsm file is required to keep your macros functional.

1
Open Save As

Click on 'File' in the top-left corner of Excel, then select 'Save As' from the menu.

2
Choose the correct format

Click on the 'Save as type' drop-down menu and choose 'Excel Macro-Enabled Workbook (*.xlsm)' instead of the standard Excel Workbook.

3
Save the file

Select your desired destination folder and click 'Save'. Your VBA code is now securely stored in the workbook.

Save the File as an Excel Macro-Enabled Workbook (.xlsm)
Manage Macros Easily with WPS

Create and Save Macro-Enabled Workbooks in WPS Office

WPS Office provides an intuitive spreadsheet tool that seamlessly supports saving and managing Macro-Enabled Workbooks. You can easily keep your VBA scripts intact without encountering format compatibility issues.

  1. 1. Open WPS Spreadsheet: Launch WPS Office and open your spreadsheet containing the macro.
  2. 2. Go to Save As: Click on 'Menu' in the top-left corner and select 'Save As'.
  3. 3. Select XLSM format: In the 'File Type' dropdown, select 'Microsoft Excel Macro-Enabled Workbook (*.xlsm)'.
  4. 4. Save your work: Click 'Save' to retain your macros safely within the WPS Spreadsheet application.
Highly compatible with Microsoft Excel formats including .xlsx, .xlsm, and .xlsLightweight and runs smoothly without consuming excess system resourcesIntuitive interface with a familiar ribbon design for a zero-learning-curve migrationCompletely free to download and use for all your essential office tasks
microsoft office alternative - wps office

Frequently Asked Questions

Why does my macro disappear after saving my Excel file?

If you save your file in the default .xlsx format, Excel automatically removes any VBA code to prevent macro-based viruses. You must explicitly save the file as a Macro-Enabled Workbook (.xlsm) to keep your macros intact.

Can I run macros in an .xlsx file?

No, the standard .xlsx file format cannot execute or store macros. To run macros, the code must be stored in supported macro-enabled formats like .xlsm, .xlsb, or the older .xls format.

Why is the macro button greyed out in my Excel workbook?

This usually happens if macros are disabled in your Trust Center settings, if the file is opened in Protected View, or if the current file format strips the macro content.