Does Outlook Have VBA? Macros Explained
In this article
Yes, Outlook has VBA. Microsoft Outlook on Windows includes a full Visual Basic for Applications editor, so you can record, write and run macros that automate email, calendar, contacts and tasks. On Outlook for Mac there is no VBA editor at all, and Outlook on the web has none either, so the answer is really "yes on Windows desktop, no everywhere else."
What VBA Actually Is in Outlook
Visual Basic for Applications is the scripting language Microsoft built into its desktop Office programs. In Word and Excel it is most often used for repetitive formatting and calculations. In Outlook, VBA works differently in one important way: it lives inside the mailbox profile rather than inside an individual file. That means macros are stored in a single project tied to your Outlook installation, and they can respond to events such as a new mail item arriving, an item being sent, or a reminder firing.
The editor is reached with Alt+F11 on Windows, the same shortcut used across Office. A typical macro looks like this conceptually: a routine that takes the currently selected mail item, reads its subject and sender, and files it into a named folder. The VBA project can also create a custom form or a button on the ribbon to trigger the routine manually.
Note that Outlook's object model has security boundaries. Microsoft blocks programmatic access to address books and to the "send" action under certain conditions, and it prompts the user when an outside program tries to send mail on their behalf. These protections matter because macros are also a favourite delivery method for malware.
Where VBA Is and Is Not Available
Availability is the part people most often get wrong, so it helps to list it plainly. Menu labels for these areas can differ slightly by version, device and region.
- Outlook for Windows (desktop): VBA is included. The developer tools tab is visible once you enable it in the options, and Alt+F11 opens the editor.
- Outlook for Mac: there is no VBA editor. Mac Office once had limited VBA support in other apps, but Outlook for Mac does not offer a macro environment.
- Outlook on the web: no VBA. Browser-based Outlook cannot run local code.
- Outlook mobile apps (iPhone, Android): no VBA. Phones and tablets have no script host.
- New Outlook for Windows: the redesigned client that Microsoft has been rolling out does not support VBA, and Microsoft has said classic Outlook is the version that retains it. If your macros suddenly stop working after switching clients, this is usually why.
For automation outside classic Windows Outlook, the realistic alternatives are Power Automate (which has Outlook connectors for cloud flows), the Outlook REST and Microsoft Graph APIs for developers, or add-ins built with the Office add-in model. None of these run existing VBA code unchanged.
How to Enable the Developer Tab and Open the Editor
The steps below are for classic Outlook for Windows. The exact wording of menu items can differ a little by version.
- Open Outlook and go to File > Options.
- Select Customize Ribbon in the left column.
- In the right-hand list of main tabs, tick the Developer checkbox.
- Click OK. A Developer tab now appears on the ribbon.
- Click Developer > Visual Basic, or press Alt+F11.
- In the editor, use Insert > Module to create a place for your code, or use the project explorer to work with the ThisOutlookSession object if you need event handlers.
Macro security is set separately. Look in the Trust Center section of Outlook's options for macro settings, where you can choose to disable all macros with notification (the safer default) or to enable only digitally signed macros. Enabling all macros without any checks is risky and generally not advisable on a shared or work machine.
Common Problems and Why Macros Stop Working
Most VBA complaints in Outlook fall into a handful of recognisable patterns.
- Macros do nothing after a client switch. Moving to the new Outlook removes the VBA environment entirely. Going back to classic Outlook restores it.
- A macro that sends mail is blocked. Outlook's programmatic access and object model guard may prompt or refuse. This is a security feature, not a bug, and it cannot be switched off in a supported way for ordinary users.
- The macro works once and then fails. Event-driven code in ThisOutlookSession is cleared when Outlook restarts in some situations, and code that assumes a selected item will error if nothing is selected.
- A trusted macro is quarantined. Antivirus or email security software may strip or block attachments and files containing macros. Signing your project with a digital certificate helps it stay trusted.
- Macros work for one person but not a colleague. The VBA project is per-profile. Copying the .otm export file to another machine is the usual way to move code, and it must be imported in that machine's editor.
If a macro that used to run now errors, the simplest checks first: confirm you are in classic Outlook, restart the app, and confirm the macro security level has not been tightened by an administrator. On managed corporate machines, group policy can block VBA outright, in which case only IT can change it.
VBA Versus Other Ways to Automate Outlook
VBA is not the only route, and for many tasks it is no longer the best one.
- Quick Steps and rules handle common filing, forwarding and categorising jobs with no code at all.
- Power Automate runs flows in the cloud and works with Outlook on the web and mobile too, so it keeps working if you leave the Windows desktop client.
- Office add-ins are written with web technologies and can appear in Outlook across platforms, which makes them the modern replacement for a lot of custom VBA tooling.
- Microsoft Graph is the developer route for building real applications that read and send mail through an authenticated API.
The trade-off is straightforward. VBA is fast to write, needs no deployment and can react to events inside the desktop app, but it is Windows-only, unsupported in the new client and a common malware vector. Cloud automation is more portable and auditable but cannot manipulate the desktop UI or respond instantly to local events.
Safety: Macros Are a Real Attack Vector
Because macros can run code and reach your mailbox, they are a classic delivery method for malware distributed through email attachments. A few precautions are worth stating plainly.
- Never enable macros in a document or project you did not request or did not write. Treat unsolicited files that ask you to "enable content" as suspicious.
- Keep macro settings at disable-with-notification, and prefer signed macros only.
- If you receive a macro-enabled file from someone you know, confirm with them by another channel before opening it.
- On shared or work computers, leave macro policy to IT rather than loosening it yourself.
VBA also lets code read and send items, so a malicious macro can quietly forward mail. That is precisely why Microsoft's guard prompts exist and why they should not be circumvented.
Frequently Asked Questions
Can I use VBA in Outlook on a Mac?
No. Outlook for Mac has no VBA editor, so macros written for Windows Outlook will not run there. You would need a Windows PC, or a cloud automation tool such as Power Automate, for equivalent automation.
Does the new Outlook for Windows support VBA?
No. The redesigned Outlook client does not include the VBA environment. Classic Outlook for Windows is the version that still supports macros, and Microsoft has positioned it as the one that retains that capability.
Where are my Outlook macros stored?
They live in a VBA project attached to your Outlook profile, not in individual emails. You can export the project to a file from the editor and import it elsewhere, which is how macros are typically moved between computers.
Why does Outlook warn me when a macro tries to send mail?
That is the object model guard, a built-in security feature. It prompts or blocks programs that attempt to send mail or read address books on your behalf, because that behaviour is common in malware. It is not a fault you should try to disable.
Can VBA run automatically when an email arrives?
Yes, in classic Outlook on Windows. Code placed in the ThisOutlookSession object can respond to item events such as a new message arriving, but such handlers can be cleared when Outlook restarts, so they need care.
Is VBA still a good choice for automating Outlook?
For quick, local jobs in classic Windows Outlook, it remains practical and needs no deployment. For anything that must work across platforms or survive a move to the new client, Power Automate or an add-in is the more durable option.