In Excel for Microsoft 365 on Windows, go to File > Options > Trust Center > Trust Center Settings > Macro Settings to review macro security. For most people, Disable VBA macros with notification is the sensible balance: macros stay off unless you choose to allow them in a particular trusted workbook.
Where to find the macro settings
Excel’s macro controls are part of the Trust Center. In the Windows desktop app, open File > Options, select Trust Center, click Trust Center Settings, and choose Macro Settings. Select the option you want, then confirm the dialogs. If the settings are unavailable or cannot be changed, your organization may manage them through policy.
These settings govern VBA macros in Excel. They are not the same as Excel’s general calculation, privacy, or data-connection settings. Trust Center settings are also specific to each Office application: changing Excel’s macro setting does not necessarily change Word’s or PowerPoint’s setting.
The Trust Center page may show additional controls, such as Enable Excel 4.0 macros when VBA macros are enabled. Excel 4.0 macros, also called XLM macros, are an older macro technology and are distinct from VBA. If you do not have a specific need for them, leave this type of content disabled.
What each macro security option does
The choices determine whether Excel blocks macros automatically, asks you before allowing them, or permits a narrower class of macros. Labels can vary slightly across Office builds or because an administrator has applied policy, but the main choices are:
- Disable VBA macros without notification: Excel blocks macros and generally does not offer the usual prompt to enable them. This can be appropriate for a tightly controlled environment, but it can confuse someone who needs a legitimate macro because the workbook may appear not to work.
- Disable VBA macros with notification: Excel blocks macros initially and displays a security notice when a workbook contains them. You can make a decision for a workbook you trust. This is a practical default for many users who occasionally receive macro-enabled files.
- Disable VBA macros except digitally signed macros: Excel allows signed macros from trusted publishers, subject to the publisher and certificate being trusted. An unknown or untrusted signature does not make a macro safe by itself.
- Enable VBA macros: Excel allows VBA macros to run without the normal security block. Microsoft marks this as not recommended because opening a malicious macro-enabled file can expose your computer or information to harm.
A related checkbox, Trust access to the VBA project object model, is not a general switch for running macros. It permits code to programmatically inspect or change VBA projects. Most ordinary macros do not need it, so leave it unchecked unless a trusted tool specifically requires that capability.
Why macros are treated as a security risk
A VBA macro is executable code stored in a workbook or another Office file. It can automate routine work, such as formatting a report or preparing a set of worksheets. Depending on the code and permissions, it can also change files, interact with other applications, or carry out actions the user did not expect. A familiar workbook name or a polished-looking message is not proof that its macros are safe.
Excel therefore separates opening a workbook from allowing its macros to run. A workbook can often be viewed with macros disabled, although buttons, automated imports, or other features may not function. The warning is an opportunity to verify the file’s source and purpose before allowing its code to execute—not a routine prompt to dismiss automatically.
Macro security is only one part of protection. Keep Office and Windows updated, use reputable security software, and be cautious with unexpected attachments and download links. A macro can also be legitimate but poorly written, so security and reliability are separate questions.
Internet downloads and the Mark of the Web
On supported, updated Windows versions of Office, macros in files identified as coming from the internet are blocked by default. Windows can mark downloaded files with the Mark of the Web, which tells Office the file came from an untrusted zone. Excel may display a security-risk message rather than the ordinary option to enable content. This behavior is a separate protection layer; changing the general macro setting to allow macros does not necessarily override it.
If you expected a macro file, verify who sent it and confirm through a separate, trusted channel that it is genuine. Ask the sender what the macro does and whether there is a non-macro version. Avoid removing the internet mark simply to get past a warning. If you decide a file is trustworthy, Windows may offer an Unblock option in the file’s Properties, but use it only after checking the file’s origin and your organization’s rules. Administrators can enforce stricter policies that prevent users from changing this behavior.
Do not confuse this with Protected View. Protected View can open certain files in a restricted mode because of their source or characteristics. The macro block for internet files is a related but distinct safeguard, and a workbook may encounter more than one security control.
Choosing the right setting for your situation
For a personal computer used for everyday work, leaving macros disabled with notification usually provides a useful balance: Excel does not run code automatically, but you can assess a legitimate workbook when needed. If you never use VBA and prefer not to see prompts, disabling macros without notification is a reasonable stricter choice.
In a workplace, follow your organization’s instructions rather than changing the setting to make a workbook work. IT may require signed macros, manage trusted publishers, or block changes centrally. If a business process depends on a macro, ask the workbook owner or support team for an approved copy or a secure way to use it.
Use the signed-macro option when your organization has a real process for signing code and managing trusted publishers. A digital signature can help identify the publisher and show whether signed content has changed since signing; it does not certify that the macro is harmless. Do not add an unknown publisher as trusted just because Excel presents that choice.
Enabling a trusted workbook safely
When Excel shows a security notice for a workbook you expected, pause before allowing content. Check that the sender and file name make sense, and confirm that the workbook came from the person or organization you think it did. If the file was unexpected, asks you to enable macros urgently, or requests passwords or other sensitive information, do not enable it until you have verified it.
For an ordinary notification, the workbook may offer an Enable Content action. Use it only when you have a good reason to trust that specific file. This is different from selecting Enable VBA macros globally in Trust Center: the global option changes the protection for all relevant workbooks, while an in-workbook approval is limited in scope. The precise prompt depends on the file and the security controls applied to it.
Excel also supports Trusted Locations, folders designated for files that you trust. Files placed in such a location may receive fewer security warnings, so do not designate a broad folder such as Downloads or a shared folder as trusted for convenience. Anyone who can put a file in a trusted location could potentially cause its content to receive that trust. In a managed environment, use only locations approved by IT.
Macro-enabled file formats and saving changes
Excel workbooks that contain VBA commonly use the .xlsm extension. The binary workbook format .xlsb can also contain macros. The older .xls format can store macros as well. By contrast, the standard .xlsx format does not preserve VBA macros.
If you use File > Save As and choose .xlsx for a workbook containing VBA, Excel warns that macro features will be lost. Keep a macro-capable format if the code must remain in the workbook, or save a separate .xlsx copy if you need a macro-free version. Do not assume that a file is safe simply because it has a familiar extension; consider where it came from and whether you expected it to contain code.
When sharing a workbook, tell recipients what the macro is intended to do and provide a way to verify its source. If the task can be completed without VBA, a macro-free workbook may be easier to share with people whose organizations block macros.
Excel for Mac and Excel for the web
Excel for Mac has its own macro security controls. In current Microsoft 365 versions, look under Excel > Settings > Security; older releases may label Settings as Preferences. The available controls and wording can differ from Windows, so follow the options shown in your Mac version. Do not assume that changing a Windows computer’s Trust Center setting changes the Mac’s setting.
Excel for the web does not run, create, or edit VBA macros. It can open a workbook that contains VBA, but the VBA code does not run in the browser. If you need to use that code, open the file in the Excel desktop application and follow the security controls there. Microsoft’s Office Scripts are a separate automation option for supported Microsoft 365 environments, not a way to run VBA in a browser.
Common problems and what to check
- The macro button is missing or does nothing: Check whether the workbook actually contains a macro, whether macros are blocked, and whether you are using the desktop app rather than Excel for the web. The workbook may also rely on a macro that was removed when it was saved as .xlsx.
- There is no Enable Content option: The file may be blocked because it came from the internet, or an administrator may have disabled user approval. Verify the source and contact IT instead of enabling all macros globally.
- The Trust Center setting is unavailable: A workplace policy can lock the option. Ask your administrator which approved files or publishers are permitted.
- A signed macro is still blocked: A signature is not the same as a trusted publisher. The certificate may be unknown, expired, or not trusted on that computer, or another policy may block the file.
- The workbook opens but automated features fail: That can be expected when macros are disabled. Do not enable them until you know what the workbook is meant to do and have verified its source.
Frequently Asked Questions
Should I enable macros in Excel?
Only enable a macro when you trust the workbook’s source and have a reason to use its automated features. For general use, keep macros disabled with notification rather than enabling all macros globally.
How do I turn on macros for one Excel file?
If Excel presents an ordinary security notification, review the file and use its Enable Content option only if you trust it. A file from the internet may be blocked by an additional policy, and a work-managed computer may not allow users to override that block.
Does changing macro security affect every workbook?
The Trust Center macro setting is a general Excel setting, so it can affect other workbooks opened in that Excel installation. An approval for one workbook is narrower, but internet-file protections and administrator policies can still apply.
Can Excel for the web run VBA macros?
No. Excel for the web can open a workbook that contains VBA, but it does not run, create, or edit those macros. Open the workbook in the desktop Excel app if you need VBA functionality.
Are digitally signed macros automatically safe?
No. A valid signature helps identify the publisher and whether signed code has changed, but it does not prove the code is safe or appropriate. Trust the publisher only when you can verify who they are and why the macro is needed.
Related
- Conditional Formatting: Use More Than One Rule in Excel
- table() in RStudio: How It Counts and Displays Data
- Data Validation and Reconciliation in Excel Explained
Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.
More in VBA & macros
- Google Sheets Macros: How They Work and How to Use ThemYes. Google Sheets has macros: you can record a sequence of spreadsheet actions and replay it later, or…
- VBA Loop Array: Examples, Bounds, and Best PracticesA VBA array loop visits array elements one at a time, usually with a For loop using LBound…
- VBA Range.Resize: Change a Range’s Dimensions in ExcelIn Excel VBA, use the Resize property to return a range with a different number of rows or…
- Excel Macro to Copy and Paste Data: A Practical GuideTo copy a data range between worksheets in Excel for Microsoft 365 on Windows, use a VBA macro…
- How to Print a Range in VBA: Excel Setup and ExamplesTo print a specific Excel range with VBA, assign it to a Range variable and call its PrintOut…
- Access VBA InputBox: Ask for User Input in a MacroYes. In Access VBA, call the built-in InputBox function to display a small dialog and collect a text…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.