Toggle Macro Settings in Excel: Enable or Disable?

VBA & macros · Updated November 22, 2026

In Excel for Microsoft 365 on Windows, open File > Options > Trust Center > Trust Center Settings > Macro Settings, choose the VBA macro policy you want, and select OK. For safety, keep macros disabled by default and enable a macro only when you trust its source and purpose.

What Excel macro settings control

Excel macro settings control whether VBA code is allowed to run in Office files. VBA macros can automate tasks such as formatting reports, importing data, or creating worksheets, but they can also make changes to files and perform actions a user did not expect. A workbook can contain a harmless convenience macro or code that creates a security risk; the setting governs whether Excel permits that code to run, not whether the workbook’s ordinary cell values and formulas work.

The settings apply to Excel’s handling of VBA macros, rather than acting as a simple on/off switch for every kind of automation. They do not enable Office Scripts, which are a separate automation feature, and they do not make a macro-enabled workbook safe just because it opens without a warning. File type, where the file came from, and your organization’s policies can also affect what happens when you open it.

Change the setting in Excel for Windows

  1. Open Excel and select File > Options.
  2. Choose Trust Center in the left pane, then select Trust Center Settings.
  3. Choose Macro Settings.
  4. Select the policy that suits your situation, then select OK in the Trust Center and Excel Options windows.

The setting is a Trust Center preference, not a switch on the ribbon. Depending on the Excel build, option labels may say VBA macros or simply macros. If you are changing a setting because one particular workbook is blocked, check the warning and the file’s source before changing the setting for all workbooks.

These changes affect Excel’s macro handling more broadly than a single file. If you only need to run a particular trusted workbook, prefer a file-specific approval or a properly managed trusted location over enabling every macro globally.

What each macro option means

The Trust Center generally offers several levels of protection. The wording can vary slightly between versions, but the choices have these practical effects:

  • Disable VBA macros without notification: Excel blocks VBA macros and does not show the usual prompt to enable them. This can suit tightly controlled environments, but it can make legitimate macro-enabled workbooks seem broken.
  • Disable VBA macros with notification: Macros are blocked initially, while Excel may show a security notification that lets you make a decision for a workbook. This is a useful default for many people because it avoids automatically running code while still explaining why automation did not start.
  • Disable VBA macros except digitally signed macros: Excel permits macros signed by a trusted publisher and blocks unsigned ones. A digital signature can help identify a publisher and show whether code has changed since signing; it does not prove that the code is harmless.
  • Enable VBA macros: Excel allows macros to run without the usual macro block. Microsoft warns against this because malicious code in an untrusted file could run. Avoid this as a permanent setting.

There may also be a checkbox for trusting access to the VBA project object model. That is not the ordinary setting for running a workbook’s macros. It controls whether code can programmatically inspect or change VBA projects, a capability most users do not need. Leave it off unless a specific, trusted tool requires it.

Enable a macro in one workbook

If Excel has disabled a macro but offers a security notification, you may be able to approve that workbook without changing the general policy. First confirm that you expected the file, know who supplied it, and trust the code’s purpose. Then follow the available prompt in Excel, such as selecting Enable Content in the Message Bar. The prompt’s availability depends on your macro policy and the file’s security status.

That button is not a universal override. In current Microsoft 365 builds, files marked as coming from the internet may have their macros blocked with a security warning that does not offer the normal Enable Content choice. Do not try to defeat that protection just because a file looks familiar. Verify the sender through a separate channel, obtain the workbook from a trusted source, and ask your IT administrator if the warning conflicts with a work process.

A trusted location is another option for a repeat-use workbook. Excel can treat files in a configured folder as trusted, so macro code there may run without the same prompts. Use this only for a folder whose contents you control; a broad or shared folder can make it easier for an unsafe file to be trusted inadvertently. On Windows, trusted locations are managed through the Trust Center settings. In a workplace, an administrator may control which locations are allowed.

Understand downloaded-file warnings

A downloaded workbook can carry information indicating that it came from the internet. Windows and Office use that information as part of their security checks, so changing the general macro setting may not remove a block. This is one reason the same workbook can behave differently depending on whether it arrived as an email attachment, was downloaded from a website, or was placed in a managed company location.

If you have independently verified a file’s source and your organization allows it, Windows may show an Unblock option in the file’s Properties window. To check, close the workbook, right-click the file in File Explorer, choose Properties, and look on the General tab. Only use Unblock when you understand why the file is blocked and trust its origin. Do not use it to make an unexpected attachment run; ask the sender or your IT team for a verified copy instead.

Protected View is related but different. It can open a file in a restricted mode because of its source or other security checks. Enabling editing in Protected View does not automatically mean that macros are safe or permitted. Read the security messages separately and do not treat a prompt to enable editing as approval to run code.

Macro-enabled file types and what is unaffected

Regular Excel workbooks saved as .xlsx do not store VBA macro code. Macro-capable formats include .xlsm for macro-enabled workbooks, .xlsb for binary workbooks that can contain macros, and .xltm for macro-enabled templates. A file extension alone does not prove that a file contains useful or safe code. Be cautious if a file’s extension differs from what you expected.

Blocking macros does not normally remove the workbook’s data, formulas, formatting, or charts. It prevents VBA code from running. For example, a monthly report may still display its saved figures while a button that refreshes or reformats the report does nothing. If the workbook depends on a macro to import new information, the visible results may be out of date even though the existing cells remain available.

Excel 4.0 macros, also called XLM macros, are a legacy automation method distinct from VBA. Some Excel versions expose a separate option concerning Excel 4.0 macros. If that option appears, do not assume that a VBA selection governs it identically; follow your organization’s security guidance and keep legacy automation disabled unless a known, trusted workbook genuinely requires it.

Excel for Mac and Excel for the web

On Excel for Mac, macro controls are in Excel’s preferences rather than the Windows File > Options path. In current Microsoft 365 for Mac, look under Excel > Preferences > Security for the macro security choices. The available labels and controls can differ by version, so use the settings shown in your installed edition. Do not follow Windows-only instructions such as opening File > Options on a Mac.

Excel for the web does not run VBA macros. You can open and work with many macro-enabled files there, but VBA automation will not execute in the browser. If a workbook needs VBA, open it in the Excel desktop application and apply the appropriate security checks there. Office Scripts are a different feature and are not a way to turn VBA macros on in the web app.

Why the setting may be unavailable

If the Macro Settings controls are greyed out, missing, or revert after you change them, the workbook may be managed by an employer or school. Administrators can enforce macro policies through organizational settings, and those policies take precedence over an individual user’s preference. Contact your IT administrator rather than trying to bypass the restriction.

Also check that you are changing the setting in desktop Excel rather than the web app, and confirm that you have selected OK to close both settings dialogs. If a file remains blocked, look at the exact security banner: a macro notification, an internet-origin block, and Protected View are different conditions and may require different approved steps. Restarting Excel is not a substitute for addressing the particular warning.

Safer habits when working with macros

A sensible approach is to keep macros disabled until needed, then assess the particular file. A familiar filename, a spreadsheet logo, or an email from a known contact is not by itself proof that the macro is safe; sender accounts and files can be compromised. If a workbook unexpectedly asks you to enable code, verify the request with the purported sender using a separate communication method.

  • Prefer files from an official, verified source, and ask what the macro is supposed to do.
  • Do not enable code in unexpected attachments, files from unfamiliar websites, or workbooks that use pressure or urgent instructions to persuade you.
  • Use a managed trusted location only when its contents and access are controlled.
  • Keep Office and security software updated, and follow your organization’s rules for business files.
  • If you are unsure, leave the macro disabled and request a non-macro version or help from the file’s owner or IT support.

Frequently Asked Questions

How do I turn macros off in Excel?
On Windows, go to File > Options > Trust Center > Trust Center Settings > Macro Settings, choose a disable option, and select OK. A setting enforced by an organization may not be editable.

Can I enable macros for just one Excel file?
Sometimes. If Excel provides a notification for a trusted workbook, use its approval option. Some internet-origin files are blocked without that option. Do not lower the global security setting simply to get around a warning; verify the file and follow your organization’s approved process.

Why can’t I click Enable Content?
The file may be subject to a stronger internet-origin block, your administrator may have disabled the option, or the warning may be about Protected View rather than macros. Read the full message and ask IT for help if it is a managed device.

Does disabling macros stop Excel formulas from working?
No. It blocks VBA code, not ordinary worksheet formulas. A workbook may still show saved data and calculate formulas, but buttons or automated tasks that rely on VBA may not work.

Can Excel for the web run VBA macros?
No. Excel for the web can open many macro-enabled workbooks, but it does not execute VBA. Use the desktop Excel application if a trusted workbook requires VBA automation.

Related

Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.

More in VBA & macros

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.