How to Save an Excel File as a Macro-Enabled Workbook

Tap through each step to make sure your macros are still there the next time you open the file.

  1. Go to File and click "Save As"

    For a file that contains macros, start from "Save As" rather than a regular save.

  2. Click the file format dropdown

    In the Save As dialog, click the "Save as type" dropdown to open the list of formats.

  3. Choose "Excel Macro-Enabled Workbook (*.xlsm)"

    Selecting this format from the list is what keeps your macro code saved along with the file.

  4. Save and confirm the extension

    Click Save, and you can confirm the file was saved with a ".xlsm" extension rather than ".xlsx."

  5. Why it matters

    Saving in the regular .xlsx format silently strips out any macros, so a file built around automation needs to be saved as .xlsm to keep working.

Did a macro you built disappear after saving?

If you built a macro, saved normally, and then reopened the file to find the macro gone, it was very likely saved in the standard .xlsx format. Macros only survive when the file is saved specifically as .xlsm.

Also worth checking: recording a macro in the first place

Alongside saving in the right format, learning how to record a macro to automate repetitive tasks can meaningfully speed up everyday spreadsheet work.

Frequently Asked Questions

Can I recover the macro from a file already saved as .xlsx?

Unfortunately not β€” the macro code is stripped out the moment a file is saved as .xlsx, so it is important to save any macro-containing file as .xlsm from the start.

Why do I get a security warning when opening an .xlsm file?

Because macros can run commands automatically, which carries some security risk, Excel shows a warning by default asking you to confirm the file comes from a source you trust.