Macro settings are Excel’s security controls for deciding whether VBA macros in workbooks can run, and under what conditions. They help protect your computer from harmful code while letting you use trusted spreadsheet automation.
What macro settings control
A macro is a set of instructions that automates work in Excel. Many macros are written in Visual Basic for Applications (VBA), Microsoft Office’s programming language. A workbook might use one to format a report, import data, create a button-driven workflow, or perform calculations that are awkward to do by hand. Macros can also be written to perform harmful actions, such as changing files or accessing information, which is why Excel treats them as a security risk.
Excel’s macro settings determine whether VBA code is blocked, whether Excel displays a warning that lets you choose, and whether code from certain trusted publishers is allowed. They do not inspect a macro and certify it as safe. Nor do they change what the macro is programmed to do after it runs.
These settings are different from ordinary workbook features such as formulas, charts, and formatting. A workbook without VBA can open and work normally even when macros are disabled, although features that depend on its macros may not work.
Where to find the settings in Excel for Windows
In Excel for Microsoft 365 on Windows, open File > Options > Trust Center > Trust Center Settings > Macro Settings. The options there control Excel’s handling of VBA macros. Settings generally apply to Excel on that installation rather than being a switch saved inside one particular workbook. An organization may also manage the choices through policy, in which case some controls can be unavailable or show a notice that they are managed by an administrator.
The Trust Center includes other controls that are related to macro security but are not interchangeable with the main macro choices. For example, Trust access to the VBA project object model concerns whether code can programmatically inspect or change VBA projects. Most people who simply run a workbook’s macros do not need to enable it. Excel also has a separate option concerning Excel 4.0 macros, an older macro technology. Leave that legacy option off unless you have a specific, trusted reason to use it.
On Mac, Excel also supports VBA, but the settings screens and available controls differ by version; look under Excel’s Preferences or Settings for its security or macro security controls. Excel for the web does not run VBA macros. A workbook can be opened there, but you need the desktop Excel app to run its VBA code.
What the four main choices mean
The Macro Settings screen offers choices that trade convenience against protection. Labels can vary slightly between Excel releases, but the main behaviors are:
- Disable VBA macros without notification: VBA macros are blocked, and Excel does not provide the usual prompt to enable them. This can be appropriate in a managed environment where users should not run macros, but it can make legitimate macro-enabled workbooks seem broken.
- Disable VBA macros with notification: Macros are blocked unless you choose to allow them for a particular file through an available security prompt. This gives you a chance to consider the file instead of allowing every macro automatically.
- Disable all macros except digitally signed macros: Unsigned macros are blocked. A signed macro can be allowed when its publisher is trusted, subject to the prompts and policies in effect. A signature identifies the publisher and can help show whether code has changed since signing; it does not guarantee that the code is harmless.
- Enable VBA macros: Excel permits macros to run without the normal blocking safeguard. Microsoft marks this option as not recommended because a harmful macro may run when you open or interact with a file.
For many people, keeping macros disabled until they are needed is a sensible balance. The important distinction is that a warning gives you a decision point; it is not proof that the file is safe. Clicking an enable button should be based on whether you trust the source and expected the workbook, not simply on a prompt appearing.
How Excel decides whether a macro can run
Several factors may affect whether a macro runs, so a blocked macro is not always evidence that the main setting is wrong. Excel considers the application’s macro configuration, the file’s origin, whether a publisher is trusted, and any organization-level restrictions. The workbook’s file type matters as well.
Macro-enabled Excel files commonly use formats such as .xlsm for a macro-enabled workbook, .xlsb for a binary workbook that can contain macros, or .xlam for an add-in. The older .xls format can also contain macros. The standard .xlsx format does not store VBA macro code, so saving a macro-enabled workbook as an ordinary .xlsx can remove its VBA project. Excel warns about losing features when you try to save in an incompatible format.
In current Microsoft 365 desktop versions on Windows, macros in many files marked as coming from the internet are blocked by Office security protections. This is a separate safeguard from the choices in Macro Settings, so changing the setting to allow macros does not necessarily make an internet-downloaded file runnable. If a file came from email or a website, verify its source with the sender or publisher and follow your organization’s process. Do not remove a security block just to make an unexpected file run.
How to choose a suitable setting
Choose based on the way you use Excel and the level of trust you have in the files, not on whether macros are generally convenient. A person who rarely uses VBA can leave it disabled and allow a known workbook only when a prompt appears. Someone in an organization should follow its security rules, even if that means a workbook’s automation is unavailable.
Before allowing a macro, consider these checks:
- Were you expecting this workbook, and did it come from the person or organization you think sent it?
- Does the workbook’s purpose reasonably explain why it needs macros, such as refreshing a report or generating a document?
- Can you confirm the file through a separate trusted channel if it arrived unexpectedly or its request seems unusual?
- Does the file contain a digital signature from a publisher you recognize and trust? Remember that a signature is not a safety guarantee.
- Could you accomplish the task using formulas, built-in Excel features, or another approved tool instead?
Avoid setting Excel to enable all macros simply to solve one workbook’s problem. That changes the protection for other files too. If a trusted work file is repeatedly blocked, ask the sender or your IT administrator how it is distributed and whether there is an approved way to handle it. Do not use a trusted location as a general-purpose folder for downloads or email attachments.
Trusted publishers and trusted locations
A digital signature can identify the publisher of VBA code and help reveal whether the signed code was altered afterward. Depending on the selected macro setting, Excel may let you trust a publisher so that future macros signed by that publisher are treated differently. Trust only publishers you can verify. A valid signature says something about identity and integrity, not whether the macro’s actions are appropriate for your needs.
A trusted location is a folder Excel treats as a trusted source for certain Office content. It can reduce warnings for files placed there, which is useful for a controlled set of internal workbooks. But it also means files in that location receive a higher level of trust. Keep the folder limited to files you control, and do not designate broad locations such as a general Downloads folder as trusted. Organizations may restrict the creation of trusted locations.
Neither option is a substitute for checking a file. If a workbook’s author changes the code, its signature may no longer be valid. If someone places an unsafe file in a trusted folder, the folder’s trusted status does not make the code safe.
Common macro-setting problems
If a workbook opens but its buttons or automated reports do nothing, first check whether the workbook actually contains macros and whether it is in a macro-capable format. Then look for a security warning or a message that macros are blocked. A workbook can also rely on add-ins or other features, so the absence of working automation does not automatically mean that the macro setting is the cause.
If Excel does not show an option to enable a blocked file, the file may be subject to internet-origin protections, an administrator’s policy, or a security setting that suppresses notifications. Do not switch every macro on as a troubleshooting shortcut. Verify the file’s origin and ask the sender or IT team for the approved resolution.
If the Macro Settings choices are grayed out, a workplace policy may control them. Contact the administrator instead of trying to bypass the restriction. If a macro runs but produces an error, the problem may be in the code, missing data, unavailable permissions, or a version-specific dependency; changing macro security settings will not repair faulty code.
Macros, Office Scripts, and other alternatives
VBA macros remain useful for automating tasks in desktop Excel, especially when a workbook already depends on VBA or needs to interact with Excel’s desktop features. They can be attached to workbook events or run from buttons, but they require careful handling because they execute code on the user’s computer.
For straightforward repeated tasks, consider Excel’s built-in tools first: formulas, tables, PivotTables, Power Query, and recorded actions may meet the need without a VBA macro. Office Scripts provide another automation option in supported Microsoft 365 environments, especially for web-based workflows and integration with Power Automate. They are not simply another name for VBA: they use a different scripting model and have different capabilities and availability. Excel for the web does not run VBA, so a workflow that requires a VBA macro still needs desktop Excel.
Frequently Asked Questions
Should I enable macros in Excel?
Only allow them when you trust the workbook’s source and have a clear reason to expect its automation. Leave macros disabled for unexpected or unverified files, and follow your organization’s policy.
Are Excel macros dangerous?
Macros are code, and code can perform actions beyond ordinary spreadsheet calculations. Many are legitimate, but a harmful macro can misuse access available to Excel. Treat a prompt to enable macros as a request to make a security decision, not as routine approval.
Why are macros blocked even though I changed Macro Settings?
Other protections may apply, including Office’s blocking of macros in files marked as coming from the internet, a trusted-publisher requirement, or an administrator policy. Check the warning message and verify the file’s source rather than disabling safeguards indiscriminately.
Can I use macros in Excel for the web?
No. Excel for the web can open workbooks that contain VBA, but it does not run VBA macros. Open the file in the desktop Excel app to use its VBA automation, if your security settings permit it.
Does saving a workbook as XLSX keep its macros?
No. The standard XLSX format does not preserve a VBA project. Use a macro-enabled format such as XLSM when you need to retain VBA code, and keep a backup before changing formats.
Related
- SQL ENUM Example: Syntax, Uses, and Alternatives
- Enum Data Type Example: Meaning, Syntax, and Uses
- How to Combine Two Parts in Onshape
Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.
More in VBA & macros
- VBA Code to Sort Data by Multiple ColumnsTo sort Excel rows by multiple columns with VBA, use the worksheet’s Sort object, add one sort field…
- Excel VBA: Find a Cell with Specific Text in a RangeTo find a cell containing specific text with Excel VBA, use the Range.Find method. Set options such as…
- Count Cells by Color in Excel Without VBA: Best MethodsYes. You can count cells by color in Excel without writing VBA: filter the range by color and…
- Macro Recorder for Windows: Options and How to ChooseA macro recorder for Windows captures repeated actions and replays them, but Windows does not provide one universal…
- Excel VBA MsgBox: Syntax, Buttons, and ExamplesExcel VBA’s MsgBox function displays a dialog box with a message, optional buttons and icon, and an optional…
- VBA Range Properties: Values, Formatting, and NavigationIn Excel VBA, a Range property either returns information about cells or another range object, or changes a…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.