30 Advanced Excel Tips for 2026

Excel Champs / VBA / Save an Excel Macro-Enabled Workbook (.xlsm File Type)
By Puneet Gogia (Microsoft MVP)

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

30+ Advanced Excel Tips for 2026

No spam. Only Excel Stuff. God Promise. 😊

Press F12 (or go to File → Save As → Browse), open the Save as type list, choose Excel Macro-Enabled Workbook (*.xlsm) and click Save. The file keeps its VBA code, and the macros are ready to enable the next time it opens.

Saving a workbook that contains code as a normal .xlsx removes the code. Excel warns that “the following features cannot be saved in macro-free workbooks”; clicking Yes saves the file without its macros, so click No and choose .xlsm instead.

Excel Binary Workbook (*.xlsb) also keeps macros and is usually smaller and quicker to open for large files. To save every new workbook as .xlsm, go to File → Options → Save and change Save files in this format.

From VBA, use ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "Report.xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled. The extension and the FileFormat value must agree, or SaveAs stops with error 1004.

Macros in a file downloaded from the internet or received by email are blocked, even in .xlsm. Right-click the file, choose Properties, tick Unblock and click OK, then open it and click Enable Content.

What is a Macro-Enabled Workbook?

In Excel, when you write a macro or add VBA codes in a file, you need to save that file as a macro-enabled type in the .xlsm format. With this file type, Excel stores all the codes in the file. And you can run those codes from the file as well.

write-macro

Here you have a file with the codes, and now, we will look at how to save this file as a macro-enabled file type in Excel.

Steps to Save a Macro-Enabled Workbook

  1. First, go to the File tab and click on the “Save As” option.
  2. After that, specify the location where you want to save your file.
  3. Next, from the “Save as type” select “Excel Macro-Enabled Workbook”.
  4. In the end, click OK to save the file.
save-a-macro-enabled-workbook

Below you can see the file we have saved in our system as a .xlsm extension.

file-saved-with-.xlsm-extension

Points to Remember

  1. Once you create a macro-enabled file, you need to activate the macro (File ⇢ Options ⇢ Trust Center ⇢ Trust Enter Settings ⇢ Macros) to run a code.
  2. You can use Personal Macro Workbook to save all your codes in one place.
  3. Receiving a macro-enabled workbook from someone else (from a different system) could be a possible threat.
Puneet Gogia

Written by

Puneet Gogia

Microsoft MVP — Excel · Founder, Excel Champs

Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.

3M+ readers helped
1,000+ tutorials written
Since 2015 teaching Excel