History Lesson: What Is a .xlsm File? Why Excel Keeps Macros in a Separate Workbook
Excel’s macro-enabled workbook since 2007 — the same ZIP-of-XML package as .xlsx plus a binary VBA project, split off by one letter after a decade of macro viruses taught Microsoft to label code before anyone opens it.

TL;DR
A .xlsm file is an Excel Macro-Enabled Workbook: the same Office Open XML (OOXML) package as an ordinary .xlsx — a ZIP container of XML parts — plus a binary part, usually xl/vbaProject.bin, that holds macro code written in VBA (Visual Basic for Applications). Excel macros are as old as Excel: formula-style XLM macro sheets came first, and Excel 5.0 brought VBA in 1993. After macro viruses such as Concept (1995) and Excel’s own Laroux (1996), Excel 2007 split workbooks in two: .xlsx may not carry code, and .xlsm — the m means macros — announces that it might. Since 2022 Office on Windows also blocks VBA macros in files marked as coming from the internet. Legacy File Converter converts .xlsm locally on Windows; nothing is uploaded.
What is a .xlsm file?
Microsoft’s file-extension reference for Office gives the short version: an Excel Macro-Enabled Workbook “uses the same basic XML format as the Excel Workbook, but can store VBA macro code.” The same table says the ordinary .xlsx “can’t store VBA macro code or Microsoft Excel 4.0 macro sheets,” and that anyone who saves a workbook containing either kind of macro is prompted to use .xlsm instead. A macro here means a small program stored with the workbook that can click, type, copy, and calculate on your behalf — and, because it is a program, do things a formula cannot.
Open a copy of a .xlsm in a hex viewer — a program that shows a file’s raw bytes — and it starts with PK, the ZIP signature, exactly like a .xlsx. The sheets, styles, and shared strings are the same SpreadsheetML parts described in History Lesson: What Is a .xlsx File?. Two things differ. In [Content_Types].xml, the package’s list of part types, the workbook part is declared as application/vnd.ms-excel.sheet.macroEnabled.main+xml instead of the ordinary spreadsheet type. And a workbook with VBA has an extra part, normally xl/vbaProject.bin, linked through a relationship of type vbaProject. Microsoft’s May 2006 developer overview of the formats explains that VBA projects are stored as binary parts, not XML; its separate [MS-OVBA] specification describes that project as a compound file — the same OLE storage family as the old binary .xls.
You can check for code without opening Excel
Microsoft’s 2006 overview pointed out a new trick: you can tell whether a package contains code before running anything. Copy the file, rename the copy to .zip, and look for a vbaProject.bin part. Do not double-click a .xlsm you do not trust just to see what it does.
Why does Excel block macros in my .xlsm file?
The most common reason today is the Mark of the Web (MOTW): a hidden tag Windows adds to files that arrive from the internet or another untrusted zone, such as browser downloads and email attachments. Microsoft notes it only applies on NTFS drives, not on FAT32-formatted devices. In February 2022 Microsoft announced that VBA macros in files carrying that mark would be blocked by default in five Office apps on Windows — Access, Excel, PowerPoint, Visio, and Word. The rollout began with Version 2203 in Current Channel (Preview) in April 2022, was briefly paused that year after user feedback, then resumed, and reached Semi-Annual Enterprise Channel with Version 2208 on 10 January 2023.
Before the change, the usual default was “Disable all macros with notification”: a yellow bar appeared and one click on Enable Content let the code run. After it, a file from the internet shows a security-risk banner with no enable button. Microsoft’s documentation lists the ways macros can still run: the file is in a Trusted Location, the macros are signed by a publisher the PC already trusts, a policy allows them, or the user removes the Mark of the Web by unblocking the file. Older Excel 4.0 (XLM) macros got their own restriction: in January 2022 Microsoft’s Excel team announced they would be disabled by default in current Microsoft 365 builds.
Blocked is not the same as broken
A blocked .xlsm is usually intact; Office is refusing to run its code, not failing to read its cells. Only unblock a file you trust and expected to receive. Phishing campaigns relied on that one Enable Content click for years, which is why Microsoft took it away.
Before the m: XLM macro sheets and the arrival of VBA
Excel had macros from the start. Early versions used XLM, a macro language whose commands looked like formulas and lived in the cells of special macro sheets; XLM was Excel’s default macro language through Excel 4.0. On 29 June 1993, at the PC Expo trade show in New York, Bill Gates announced that Microsoft’s Visual Basic Application Edition would be built into Excel 5.0 and Project 4.0, according to UPI’s report from the show. Excel 5.0, released that year, became the first Microsoft application to ship VBA; it recorded new macros in VBA by default while still allowing XLM recording as an option.
Reviewers saw the point at once. Writing in April 1994, Alan Zisman called VBA “Microsoft’s new attempt at a standard macro language” that would slowly reach all of the company’s products, while Excel kept running the older XLM. Through the binary era those macros lived inside the same .xls file as the numbers (see History Lesson: What Is a .xls File?). Nothing in the name told you whether a workbook was just data or data plus a program.
Macro viruses: why one extension stopped being enough
That ambiguity soon had a price. Concept, found in July 1995, is generally described as the first macro virus; it infected Word documents through Word’s own macro language. A year later Command Software Systems announced that on 15 July 1996 it had found ExcelMacro.Laroux, which it called the first virus in the wild to exploit Excel. Laroux was written in VBA and consisted of two macros, auto_open and check_files: opening an infected workbook created a PERSONAL.XLS in Excel’s startup folder, from which the virus copied itself into other workbooks. F-Secure later noted it had no payload — it just replicated.
The best-known case came from Word. On 26 March 1999 the Melissa virus began spreading through an infected Word document whose macro used Outlook to mail itself to the first 50 contacts in the victim’s address book, according to the FBI’s history of the case. By then, every spreadsheet attachment raised the same question: are these just numbers, or is there code inside?
2007: the m in .xlsm
Office 2007 answered with the file name. Microsoft’s May 2006 overview, by Frank Rice, says default Office Open XML documents are “intended to be macro-free files, and therefore cannot contain code”; to keep macros, you save as a macro-enabled type. Such files “have the exact same file format as macro-free files, but contain additional parts.” Workbooks with Excel 4.0-style XLM macros are saved as macro-enabled too. Macro-enabled extensions end in m instead of x, which, in the overview’s words, lets “any users or software applications, before a document opens,” identify that it contains code. Excel gained .xlsm for workbooks, .xltm for macro-enabled templates, and .xlam for add-ins; Word got .docm and PowerPoint .pptm (see History Lesson: What Is a .docx File? and History Lesson: What Is a .pptx File?).
The split was enforced, not just suggested. The same overview says that if a code part turns up in a macro-free file, “whether placed there accidentally or maliciously,” Office will not run it, and that Office prevents such a document from opening. That is why renaming a .xlsm to .xlsx does not make it safe or working: the package still declares a macro-enabled workbook and still carries its VBA part, so Excel may refuse to open it at all. To remove macros properly, open a copy and use Save As → .xlsx; Excel warns that the VBA project cannot be saved in a macro-free workbook and drops it if you continue. The cells and formulas stay; the program does not. Going the other way, renaming a .xlsx to .xlsm adds no macros.
Not every macro workbook is a .xlsm
Excel’s binary .xlsb workbook, introduced in the same 2007 release, can also store VBA and XLM macros, and older .xls files can hold them too. The m-for-macros rule applies to the XML family; the extension alone does not prove that any other workbook is code-free.
Why .xlsm files still sit on disks in 2026
Macros never went away, so neither did the format. Microsoft registered the media type application/vnd.ms-excel.sheet.macroEnabled.12 for .xlsm with IANA, the internet’s registry of file types, in February 2011, describing its intended usage as common. Budget models with a button that rebuilds every tab, monthly report generators, order forms, and team templates were built in VBA by colleagues who may have moved on long ago. Those workbooks become legacy files when the macros are blocked, the person who understood them leaves, the PC lacks desktop Excel, or someone only needs the data in another format.
Legacy File Converter lists .xlsm (Microsoft Excel, macro-enabled) among supported spreadsheets on Supported File Types and converts it locally on Windows. Nothing is uploaded. This article stays the history. For the macro-free sibling, see History Lesson: What Is a .xlsx File?; for the binary workbook that carried Excel’s macros before 2007, see History Lesson: What Is a .xls File?.
Related reading
- History Lesson: What Is a .xlsx File? A ZIP of SpreadsheetML Excel Made the Default
- History Lesson: What Is a .xls File? Not the Same as .xlsx
- History Lesson: What Is a .docx File? A ZIP of XML That Word 2007 Made the Default
- History Lesson: What Is a .pptx File? A ZIP of PresentationML PowerPoint Made the Default
Ready to open your old files?
Start free, then unlock unlimited conversions with a one-time $79.95 Standard license. Download the Windows installer — full features for up to 10 files.
Free trial
Full app features · up to 10 files
Windows 10 or 11
Free trial — convert up to 10 files. Download the Windows installer and convert locally on your PC.
Direct Windows installer · offline MSI
Is this safe? — publisher, installer, and SmartScreen help
Requires Windows 10 or 11. No subscriptions.