logo
search
VBA & Macro Problems

Fix Excel Macros Disabled When Opening an XLSM File in OneNote

Tauseeq MagsiTauseeq Magsi Oct 9, 2026 870 views

Question details

Users are unable to run macros in an Excel file (.xlsm) when the file is opened directly from Microsoft OneNote.

How to Fix Excel Macros Disabled When Opening a File in OneNote
Product
Excel, OneNote
Device & OS
not provided
Scenario
Opening an Excel macro-enabled workbook stored as an attachment or link inside a OneNote page.
Observed behavior
The Excel file opens, but macros are automatically disabled due to application restrictions, preventing VBA code from executing.
Before you start

Verify that your workbook is saved in the macro-enabled format (.xlsm) and ensure you have administrative permissions to modify Excel Trust Center settings on your computer.

Solution 1Recommended

Save the File Locally and Open Directly in Microsoft Excel

Since OneNote opens attachments in a temporary directory which triggers Excel's Protected View and disables macros, saving the file locally resolves the security block.

Microsoft OneNote is designed as a note-taking application and does not natively execute or securely manage Excel VBA macros. When you open a macro-enabled Excel file directly from a OneNote attachment, Excel treats it as originating from an untrusted temporary internet location, thereby disabling the macros.

1
Save the attachment locally

Right-click the Excel file icon embedded in your OneNote page and select 'Save As'. Choose a local destination on your computer, such as your Desktop or Documents folder.

2
Open the file in Excel

Launch Microsoft Excel directly from your Start menu or taskbar. Go to File > Open, browse to the location where you just saved the .xlsm file, and open it.

3
Enable macros via Trust Center

If a yellow security warning appears at the top of the workbook stating that macros have been disabled, click the 'Enable Content' button. This will permit the VBA code to run from this trusted local file.

Save the File Locally and Open Directly in Microsoft Excel
Add Trusted Locations: If you frequently use specific folders for your macro files, you can add them to Excel by navigating to File > Options > Trust Center > Trust Center Settings > Trusted Locations.
Free Microsoft Office alternative

Experience Seamless Spreadsheet Management with WPS Office

If you are tired of complex security restrictions and cross-application compatibility issues in Microsoft Office, try WPS Office. It provides a lightweight, highly compatible, and user-friendly environment for viewing, editing, and managing all your spreadsheets securely.

  1. 1. Download the software: Visit the official WPS Office website and click the free download button.
  2. 2. Install WPS Office: Run the downloaded installer and follow the on-screen instructions to complete the setup.
  3. 3. Open your spreadsheet: Launch WPS Spreadsheets and seamlessly open your existing Excel documents without format loss.
Fully compatible with Microsoft Excel (.xlsx, .xls, .xlsm) formats.Lightweight installation package for fast startup and smooth performance.Familiar tabbed interface requiring zero learning curve.Completely free for everyday office tasks and document viewing.
microsoft office alternative - wps office

Frequently Asked Questions

Why do Excel macros work on my desktop but not when opened from OneNote?

When you open a file directly from OneNote, it extracts the file to a temporary system folder. Microsoft Excel’s Trust Center identifies this temporary folder as an unsafe location and automatically opens the file in Protected View with macros permanently disabled for security reasons.

Does Microsoft OneNote support VBA macros?

No, Microsoft OneNote does not natively support Visual Basic for Applications (VBA) macros. While Word, Excel, and PowerPoint have built-in VBA editors, automating OneNote requires third-party add-ins (like Onetastic) or using the OneNote API.

How can I permanently trust a macro-enabled Excel file?

To permanently trust a file, you must save it to a local drive. Then, open Excel, go to File > Options > Trust Center > Trust Center Settings > Trusted Locations, and add the folder where your file is saved. Files opened from Trusted Locations will not prompt for macro approval.