When Excel shows the error "Programmatic Access Not Trusted," it blocks VBA macros from interacting with other applications or system resources for security reasons. This is not a bug—it's a built-in protection. Enabling programmatic access lets your VBA code control Outlook, Word, Excel objects, or automate file operations, but it must be explicitly allowed in Excel’s Trust Center. Without this setting, macros that use objects like Outlook.Application or FileSystemObject will fail with runtime errors. You need administrator rights on the machine and a basic understanding of Excel’s Trust Center to fix this.

What You'll Need

  • Administrative privileges on the Windows computer
  • Microsoft Excel 2010 or later (32-bit or 64-bit)
  • A VBA macro that requires programmatic access (e.g., sending emails via Outlook or reading/writing files outside Excel)
  • Access to Excel’s Trust Center settings

Step-by-Step

  1. Close all instances of Excel completely. Check Task Manager (Ctrl+Shift+Esc) and end any remaining EXCEL.EXE processes to ensure no hidden instances are running.
  2. Open Excel again. Do not open any workbook yet—start with a blank workbook or the startup screen.
  3. Click the File tab in the top-left corner of the Excel window.
  4. Select Options from the bottom of the left-hand menu. This opens the Excel Options dialog box.
  5. In the Excel Options dialog, click Trust Center on the left sidebar, then click Trust Center Settings... at the bottom right.
  6. In the Trust Center window, select Macro Settings from the left panel.
  7. Under the Programmatic Access section, check the box labeled "Trust access to the VBA project object model." This is the critical setting that enables programmatic access.
  8. Click OK to close the Trust Center window, then click OK again to close Excel Options.
  9. Restart Excel one final time to ensure the setting is fully applied.
  10. Open the workbook containing your VBA code and run the macro. The programmatic access error should no longer appear.

Common Mistakes

  • Skipping the step to restart Excel after changing Trust Center settings—changes won’t take effect until Excel is fully restarted.
  • Assuming the setting applies to all users on the machine—it only affects the current Windows user profile. Other users must set it individually.
  • Enabling "Trust all installed add-ins" or "Enable all macros" instead of the correct setting—these are unrelated and do not resolve programmatic access errors.
  • Trying to fix the issue by modifying registry keys or third-party tools—this is unnecessary and risky. The Trust Center setting is the only official method.
  • Running Excel without administrator rights on a corporate or managed device—some organizations block this setting entirely, requiring IT approval.

Tips

  • Always test your macro in a sandbox workbook first—don’t rely on production data until you’re certain the setting works.
  • If you use macros frequently, consider adding a simple error handler in VBA to catch and log programmatic access failures with a user-friendly message.
  • On shared or corporate computers, ask your IT department to push this setting via Group Policy if multiple users need it.
  • Disable this setting when not in use—it reduces attack surface. Only enable it temporarily for trusted workbooks.
  • If you’re using Excel Online or Excel on mobile, programmatic access is not available—VBA is unsupported on those platforms entirely.
  • For macros that interact with Outlook, make sure Outlook is installed and running (or at least registered in the system) before running the code.

Troubleshooting

  • If the setting is checked but the error persists, verify you’re editing the correct user profile. Log out and back in, or try opening Excel under a different Windows account to test.
  • Check if your organization uses Microsoft Intune or Group Policy to override local settings. Contact your IT admin—this setting may be locked down.
  • Run Excel in Safe Mode (hold Ctrl while launching Excel) to rule out add-ins interfering. If it works in Safe Mode, disable add-ins one by one via File > Options > Add-Ins.
  • Ensure your VBA code is not referencing an object library that isn’t registered. For example, if using Outlook, go to Tools > References in the VBA editor and confirm "Microsoft Outlook xx.x Object Library" is checked (not missing or marked as "Missing").
  • If using Excel 2016 or later on Windows 10/11, ensure Windows Defender Application Control or SmartScreen isn’t blocking Excel’s executable. Temporarily disable real-time protection to test (re-enable immediately after).
  • As a last resort, repair Office: Go to Windows Settings > Apps > Microsoft Office > Modify > Quick Repair. If that fails, choose Online Repair.

Frequently Asked Questions

Why does Excel block programmatic access by default?

It’s a security measure to prevent malicious macros from taking control of other applications like Outlook or Word, which could send spam emails or delete files without your knowledge.

Can I enable this for all users on my computer?

No, this setting is user-specific. Each Windows user must enable it individually in their own Excel Trust Center.

Does this setting affect macro security in other ways?

No. Enabling programmatic access only allows VBA code to interact with external objects. It does not change how Excel handles macro execution, file opening, or macro warnings.

Why does my macro still fail even after enabling the setting?

Check if the referenced application (like Outlook) is installed and registered. Also verify that your VBA code has correct object declarations and that you’re not trying to access restricted system folders.

Is this setting available in Excel for Mac?

No. Excel for Mac does not support programmatic access to external applications via VBA in the same way. VBA support on Mac is limited and differs significantly from Windows.

Will this setting be lost after an Office update?

Usually not. Trust Center settings persist through standard updates. However, a full Office reinstall or major OS upgrade may reset them.