VBA & Macro Problems

Excel Cannot Save a Macro-Enabled Workbook: Fix .xlsm and Macro Settings

Phi Hung VoPhi Hung Vo Nov 12, 2026 870 views

Question details

The user needs to save an Excel workbook after enabling or adding a macro.

Excel Cannot Save a Macro-Enabled Workbook: Fix .xlsm and Macro Settings
Product
Microsoft Excel
Device & OS
not provided
Scenario
A workbook contains or uses VBA macros, but Excel does not save it correctly after a macro is enabled.
Observed behavior
The workbook cannot be saved as expected, potentially because macros are blocked or the file is being saved in the standard .xlsx format.
Before you start

Confirm that the workbook contains VBA code and check its current file extension. Only enable macros when the workbook comes from a trusted source.

Solution 1Recommended

Save the workbook as an Excel Macro-Enabled Workbook

Use this solution when the workbook contains VBA code and Excel is rejecting or removing the macro during saving.

The standard .xlsx format cannot store VBA projects. Saving a macro-containing workbook as .xlsm preserves the macro code and allows Excel to save it correctly.

1
Open Save As

In Excel, select File > Save As, then choose Browse if necessary to open the file-saving dialog.

2
Choose the macro-enabled format

Open the Save as type menu and select Excel Macro-Enabled Workbook (*.xlsm).

3
Save and confirm the format

Enter a file name, select Save, and choose Yes or Keep the current format if Excel warns that some features cannot be saved in the selected format.

Use the .xlsm extension: Do not save a VBA workbook as .xlsx, because that format cannot store VBA projects.
Free Microsoft Office alternative

Open and save macro-enabled workbooks with WPS Office

WPS Office is a free, lightweight Microsoft Office alternative with a familiar interface and support for common Excel formats. It can help you open, edit, and save compatible workbooks while you migrate from Excel, although VBA macro behavior may depend on the specific macro and WPS support.

  1. 1. Open the workbook in WPS Spreadsheets: Launch WPS Office, select Spreadsheets, and choose Open to load the Excel workbook.
  2. 2. Review macro compatibility: Check the workbook's macro-related features and confirm that the required VBA behavior is supported before editing.
  3. 3. Save in a compatible format: Select Menu > Save As and choose Excel Macro-Enabled Workbook (*.xlsm) when the workbook must retain macro content.
Open and edit common Excel workbooks with a familiar spreadsheet interface.Support Microsoft Excel .xlsx and macro-enabled .xlsm file formats for compatible documents.Use a lightweight office suite for everyday spreadsheet editing and file conversion.Move between WPS Office and Microsoft Excel with broadly compatible formatting.
QA img-9

Frequently Asked Questions

Why can’t I save a macro workbook as an .xlsx file?

The .xlsx format does not support VBA projects. Use File > Save As and select Excel Macro-Enabled Workbook (*.xlsm) to preserve the macros.

Where do I enable macros in Excel?

Go to File > Options > Trust Center > Trust Center Settings > Macro Settings, then select the appropriate option for a trusted workbook.

Will changing Macro Settings restore a deleted macro?

No. Macro Settings control whether existing macros can run; they do not restore VBA code removed by saving the file as .xlsx. Check for an earlier .xlsm copy if the code was removed.

What should I do if Excel still will not save the .xlsm file?

Try File > Save As to a new local .xlsm file, check whether the workbook or folder is read-only, and verify that the file is not open by another program or user.

Can WPS Office open Excel macro-enabled workbooks?

WPS Office can open and save compatible .xlsm files, but individual VBA procedures or Excel-specific features may not work identically. Test the macro behavior before relying on the file.