Dear @Mohammed Tayel,
Thank you for posting your question in the Microsoft Q&A forum. I understand how disruptive it is when a workbook that worked in Office 2010 is suddenly blocked after upgrading to Microsoft 365. The banner “SECURITY RISK: Microsoft has blocked macros from running because the source of this file is untrusted” is expected behavior in Microsoft 365: Office now blocks macros in files that carry the Windows “Mark of the Web” (MOTW) or come from untrusted locations to protect against malware. Macros from the internet are blocked by default in Office - Microsoft 365 Apps | Microsoft Learn
Below are the most reliable, supportable ways to re‑enable your trusted VBA workbook.
Step 1: Unblock the file (remove the MOTW)
If the workbook was downloaded or emailed, Windows may have marked it as “from the internet.”
- Close Excel > Right‑click the .xlsm file > Properties > check “Unblock” > Apply > reopen.
This removes the MOTW so Excel can run macros if another settings permit.
For detailed information, see How to fix "Microsoft has blocked macros" (2 simple ways)
Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.
Step 2: Use a trusted location
Move the workbook into a folder you designate as trusted so Office won’t open it in Protected View or block active content.
- Excel: File > Options > Trust Center > Trust Center Settings > Trusted Locations > Add new location (tick Subfolders also trusted if needed).
Add, remove, or change a trusted location in Microsoft Office - - Admin guidance: network‑based trusted locations can be disabled in enterprise security baselines; use with care.
Step 3: Check macro security settings (per‑app)
- Excel: File > Options > Trust Center > Trust Center Settings > Macro Settings > usually “Disable VBA macros with notification” so you can enable case‑by‑case. Note: IT policies can lock these settings.
For detailed information, see Enable or disable macros in Microsoft 365 files - Microsoft Support
Step 4: Open from OneDrive/SharePoint correctly
If the file lives in OneDrive/SharePoint, use Open in Desktop App and ensure it resides in a trusted local/synced path or unblock the local copy’s MOTW as above.
- Digitally sign your VBA project
Sign the macro with a trusted code‑signing certificate (internal PKI or public CA). Then set Excel to “Disable all macros except digitally signed macros.” Signed code runs without prompts when the publisher is trusted. Change macro security settings in Excel - Microsoft Support
- Admin controls via policy/Intune/Group Policy
Your IT admin can centrally manage macro behavior (e.g., block macros from the internet, manage trusted locations, enforce notification behavior). This is the most secure route in enterprise environments. Macros from the internet are blocked by default in Office - Microsoft 365 Apps | Microsoft Learn
I truly hope you understand that the initial steps I suggested may not have completely resolved the issue, as there might still be underlying causes, we haven't uncovered yet. Please know that I’m here with you every step of the way, ready to work together and do everything I can to help troubleshoot and find the best solution.
Please let me know if you have any further questions or if the problem persists after trying these solutions. Thank you for your patience and cooperation.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.