Fix Excel Macros Disabled When Opening an XLSM File in OneNote
Question details
Users are unable to run macros in an Excel file (.xlsm) when the file is opened directly from Microsoft 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.
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.
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.
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.
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.
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.

Seek Advanced Help in Microsoft Tech Communities
If macros are still disabled after saving the file locally, the issue is related to deep Excel macro security settings rather than OneNote.
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. Download the software: Visit the official WPS Office website and click the free download button.
- 2. Install WPS Office: Run the downloaded installer and follow the on-screen instructions to complete the setup.
- 3. Open your spreadsheet: Launch WPS Spreadsheets and seamlessly open your existing Excel documents without format loss.

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.




