How to Choose Between .xlsx and .xlsm Excel File Formats Based on Macro Use
🔍 WiseChecker

How to Choose Between .xlsx and .xlsm Excel File Formats Based on Macro Use

You need to save an Excel workbook but are unsure which file format to use. The choice between .xlsx and .xlsm depends entirely on whether your file contains macros. Using the wrong format can cause you to lose functionality or create unnecessary security warnings. This article explains the technical differences and provides clear steps for selecting and saving the correct format.

Key Takeaways: Choosing the Correct Excel File Format

  • .xlsx format (Excel Workbook): Use this standard format for files without any macros, VBA code, or interactive form controls.
  • .xlsm format (Excel Macro-Enabled Workbook): Select this format to preserve and run any macros, UserForms, or VBA project code within the file.
  • File > Save As > Save as type: This menu is the definitive way to change a workbook’s format and ensure macro content is saved correctly.

Understanding the .xlsx and .xlsm Format Specifications

Excel introduced the .xlsx format with the 2007 version as part of the Office Open XML standard. It is a zipped container for XML files that define the workbook’s data, formatting, and formulas. By design, this format cannot store macro code. Any VBA modules, macro sheets, or UserForms are automatically stripped out when you save a file as .xlsx. This makes .xlsx the default and most secure choice for general use, as it prevents potentially harmful code from being distributed.

The .xlsm format is technically identical to .xlsx in its core structure but includes an additional component: a vbaProject.bin file within the zipped container. This binary file stores all the Visual Basic for Applications project data. When Excel opens a .xlsm file, it checks for this component and loads the macro code into memory. The “m” in the extension explicitly signals to users and security systems that the file contains executable code, which triggers Excel’s macro security prompts upon opening.

Prerequisites for Using .xlsm

To both create and run macros in a .xlsm file, you must have the Developer tab enabled in Excel. You also need to adjust macro security settings to allow macros to run, which is managed via File > Options > Trust Center > Trust Center Settings. Your computer must have the VBA project system installed, which is part of a standard Office installation but can be omitted in some volume-licensed deployments.

Steps to Save Your Workbook in the Correct Format

The saving process is the same whether you are creating a new file or converting an existing one. Always use the Save As dialog to explicitly choose the format.

  1. Click File > Save As
    Select the File tab on the ribbon, then choose Save As from the left-hand menu. Click the Browse button to open the full Save As dialog window.
  2. Choose the save location and file name
    Navigate to the folder where you want to save the workbook. Enter your desired file name in the “File name” field at the bottom of the dialog.
  3. Open the “Save as type” dropdown menu
    Click the dropdown box labeled “Save as type” directly below the file name field. A long list of file formats will appear.
  4. Select the appropriate format
    If your workbook contains any macros, scroll down and select “Excel Macro-Enabled Workbook (*.xlsm)”. If your workbook has no macros, select “Excel Workbook (*.xlsx)” from near the top of the list.
  5. Click the Save button
    Click Save to finalize the operation. Excel will save the file with the chosen extension. A warning message will appear if you try to save a macro-containing workbook as .xlsx, informing you that the VB project will be lost.

How to Check for Macros Before Saving

If you are unsure whether your workbook contains macros, check before saving. View the Developer tab on the ribbon. If the Visual Basic, Macros, and Insert buttons are active, macros may be present. Press Alt + F11 to open the Visual Basic Editor. If the Project Explorer pane shows any modules, class modules, or UserForms under your workbook’s name, the file contains VBA code and must be saved as .xlsm.

Common Mistakes and Limitations to Avoid

“Excel Says My .xlsm File Has No Macros”

This happens if you create a new .xlsm file from a template but never add any macro code. The .xlsm format allows macros but does not require them. The file will work normally. You can safely convert it to .xlsx via Save As if you want to remove the macro-enabled designation and associated security prompts.

Losing Macros by Accidentally Saving as .xlsx

If you overwrite a macro-enabled workbook with a .xlsx save, Excel permanently deletes the VBA project. There is no undo function for this action. The only way to recover the macros is from a previous backup copy of the file saved as .xlsm. Always heed the warning dialog that appears when you attempt this action.

Macros Not Running in a .xlsm File on Another Computer

This is almost always a macro security setting issue, not a file format problem. The recipient’s Excel Trust Center may be set to “Disable all macros without notification.” Instruct them to check their settings under File > Options > Trust Center or to enable content via the “Security Warning” message bar that appears when the file opens.

.xlsx vs .xlsm: Key Differences

Item .xlsx (Excel Workbook) .xlsm (Excel Macro-Enabled Workbook)
Primary Use Standard workbooks without code Workbooks containing macros or VBA
File Contents Sheets, data, formulas, charts All .xlsx content plus a vbaProject.bin file
Security Prompt on Open None typically Displays a security warning bar about macros
Default Save Behavior Default format for new workbooks Must be manually selected from Save As menu
Compatibility Risk Very low; universally accepted Some organizational policies block .xlsm files

You can now confidently choose the right Excel file format for your needs. Use .xlsx for standard spreadsheets and .xlsm when automation with macros is required. For advanced control, use the Trust Center settings to manage how Excel handles macros from different file locations. Remember that pressing Alt + F11 is the fastest way to inspect a workbook for hidden VBA code before deciding on a format.