If VBA macros in Outlook are not running, the most common causes are that macro security is set to disable them, the macro is stored in a template that Outlook does not load, or the code itself has a compile error. The fix is to check the Trust Center macro settings, confirm the macro is in the right location (usually the VbaProject.OTM file), and verify the code compiles. This guide walks through those steps in order, starting with the safest checks.
What You'll Need
- Outlook desktop for Windows (VBA is not available in Outlook for Mac or Outlook on the web).
- Administrator rights on the PC if your organisation manages macro settings centrally.
- The Developer tab enabled in Outlook (instructions below).
- A backup of any existing macros before you change settings or move files.
Step-by-Step
- Confirm you are using the desktop app. VBA does not exist in Outlook on the web, Outlook for Mac, or the mobile apps. If you are in a browser, no macro will run. Open the installed Outlook program on Windows.
- Enable the Developer tab. In Outlook, go to File > Options > Customize Ribbon. In the right-hand list, tick Developer, then click OK. The Developer tab now appears on the ribbon.
- Open the VBA editor. On the Developer tab, click Visual Basic (or press Alt+F11). The editor opens with a Project pane on the left.
- Check macro security. In Outlook, go to File > Options > Trust Center > Trust Center Settings > Macro Settings. For testing, choose Notifications for all macros or Enable all macros (the latter is not recommended for everyday use). Click OK. Note that labels can differ slightly by Outlook version and by organisation policy; if the options are greyed out, your IT department controls them.
- Verify the macro is in the correct project. In the VBA editor, look under Project1 > Microsoft Outlook Objects > ThisOutlookSession for Outlook-wide macros, or under Modules for standard code. Code pasted into the wrong project (for example, a Word template) will never run in Outlook.
- Compile the code. In the VBA editor, click Debug > Compile VBAProject. If an error appears, fix the highlighted line. A macro with a compile error will not run even if security allows it.
- Check for missing references. In the VBA editor, click Tools > References. Any item marked MISSING must be unticked or the correct library installed. Click OK after changes.
- Run the macro manually. Place the cursor inside the subroutine and press F5, or use Run > Run Sub/UserForm. If it runs now, the problem was security or location, not the code.
- Confirm the startup template is loading. Outlook stores VBA in a file called VbaProject.OTM, usually in %appdata%\Microsoft\Outlook. If that file is missing or corrupted, macros disappear. Close Outlook, rename the file to VbaProject.OTM.bak, reopen Outlook, and re-import your code. Warning: renaming removes your macros from Outlook until you restore the backup, so keep the .bak file safe.
- Test with a minimal macro. Create a new module and paste a simple subroutine that shows a message box. If that runs but your original does not, the issue is in your code, not Outlook.
Common Mistakes
- Pasting code into ThisOutlookSession when it belongs in a standard module, or vice versa. Event handlers such as Application_Startup must be in ThisOutlookSession; ordinary macros belong in a module.
- Leaving macro security on Disable all macros without notification, then wondering why nothing happens.
- Editing the wrong VbaProject.OTM when multiple Windows profiles exist on the same PC.
- Forgetting that Outlook must be restarted after some security changes.
- Assuming a macro that works in Excel will work unchanged in Outlook; the object models are different.
Tips
- Keep a copy of VbaProject.OTM in a separate folder so you can restore macros after a profile rebuild.
- Use Notifications for all macros rather than Enable all macros for day-to-day safety.
- Add
Option Explicitat the top of modules to catch undeclared variables early. - Test macros on a non-critical mailbox first.
Troubleshooting
If the Developer tab is missing and Customize Ribbon will not let you add it, your organisation has locked the ribbon; ask IT. If macros are greyed out entirely, group policy is likely blocking them. If Outlook crashes when you open the VBA editor, a corrupt VbaProject.OTM is the usual cause; rename it as described above and rebuild. If a macro runs but does nothing, add a message box at the start to confirm it is being called, then step through with F8. If you see a "macros are disabled" banner, click the option to enable for that session only and check Trust Center again. For code that fails only on certain items, check whether the item is an email, meeting, or contact; each has a different object type.
Frequently Asked Questions
Why is VBA not available in Outlook on my Mac?
Microsoft does not provide a VBA editor in Outlook for Mac. Use Outlook on Windows for VBA, or automate with supported alternatives such as Power Automate.
Where are Outlook macros stored?
In a file named VbaProject.OTM in your Outlook data folder, typically under %appdata%\Microsoft\Outlook.
Can I run a macro from a rules trigger?
Yes, Outlook rules can run a script, but the macro must be in the correct project and macro security must allow it.
Why does my macro work in the editor but not from a button?
The button may point to a macro name that no longer exists or is in a different module. Reassign the button to the current procedure.
Does disabling macros delete my code?
No. Security settings only prevent execution; the code remains in VbaProject.OTM.