Free tools Windows power users keep installed
One-click scans. No signup required.
Outlook VBA macros let you automate repetitive tasks such as processing selected messages, creating reports, or responding to application events. The steps below apply to classic Outlook for Windows, including Outlook for Microsoft 365, Outlook 2024, Outlook 2021, Outlook 2019, and Outlook 2016.
They do not apply to new Outlook for Windows or Outlook for Mac. Those versions do not support Outlook VBA macros.
Before you start: check your Outlook version
VBA macros require classic Outlook. If you see a Developer tab, Visual Basic, or the classic Outlook ribbon, you are probably using the correct application.
New Outlook for Windows has a different interface and does not support VBA macros or the Developer tab. Outlook for Mac also does not support Outlook VBA macros. On some newer Windows computers, only new Outlook may be installed. In that case, install classic Outlook separately before following these instructions.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →#1 Best Overall
- All-day Comfort: The design of this standard keyboard creates a comfortable typing experience thanks to the deep-profile keys and full-size standard layout with F-keys and number pad
- Easy to Set-up and Use: Set-up couldn't be easier, you simply plug in this corded keyboard via USB on your desktop or laptop and start using right away without any software installation
- Compatibility: This full-size keyboard is compatible with Windows 7, 8, 10 or later, plus it's a reliable and durable partner for your desk at home, or at work
- Spill-proof: This durable keyboard features a spill-resistant design (1), anti-fade keys and sturdy tilt legs with adjustable height, meaning this keyboard is built to last
- Plastic parts in K120 include 51% certified post-consumer recycled plastic*
1. Show the Developer tab
The Developer tab is hidden by default in classic Outlook.
- Open Outlook.
- Select File.
- Select Options.
- Choose Customize Ribbon.
- Under Main Tabs, select the Developer check box.
- Select OK.
The Developer tab should now appear in the Outlook ribbon. If the option is missing, confirm that you are not using new Outlook.
2. Create a basic Outlook macro
The quickest way to create a macro is through the Macro dialog.
- Select the Developer tab.
- In the Code group, select Macros.
- Enter a name in the Macro name box. For example, enter
HelloOutlook. - Select Create.
Outlook opens the Visual Basic for Applications editor and creates a procedure template. Replace the template with this test macro:
Public Sub HelloOutlook()
MsgBox "Hello from Outlook"
End Sub
Macro names cannot contain spaces. Use letters, numbers, and underscores, and do not begin the name with a number. Examples include ProcessSelectedMail, Archive_Old_Messages, and SendDailyReport.
3. Put a manually run macro in a standard module
A macro that you intend to start yourself from the Macros dialog should be a Public Sub in a standard code module. It should not normally be placed in ThisOutlookSession, a class module, or a form module.
To create a standard module:
- In Outlook, select Developer > Visual Basic.
- In the Visual Basic Editor, locate the Outlook VBA project in Project Explorer.
- Select Insert > Module.
- Paste or type your procedure in the new module.
For example:
Public Sub ShowMessage()
MsgBox "This macro is running."
End Sub
Only public subroutines in suitable code modules are treated as normal Outlook macros. A Function, a Private Sub, or a procedure in a class or form module may not appear in the Macro dialog.
Rank #2
- Reliable Plug and Play: The USB receiver provides a reliable wireless connection up to 33 ft (1), so you can forget about drop-outs and delays and you can take it wherever you use your computer
- Type in Comfort: The design of this keyboard creates a comfortable typing experience thanks to the low-profile, quiet keys and standard layout with full-size F-keys, number pad, and arrow keys
- Durable and Resilient: This full-size wireless keyboard features a spill-resistant design (2), durable keys and sturdy tilt legs with adjustable height
- Long Battery Life: MK270 combo features a 36-month keyboard and 12-month mouse battery life (3), along with on/off switches allowing you to go months without the hassle of changing batteries
- Easy to Use: This wireless keyboard and mouse combo features 8 multimedia hotkeys for instant access to the Internet, email, play/pause, and volume so you can easily check out your favorite sites
4. Save the VBA project
Save your work in the Visual Basic Editor, or close Outlook and save when prompted.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchUnlike Word or Excel, Outlook does not store its VBA code inside a document or workbook. Outlook normally stores the project in:
%AppData%MicrosoftOutlook
The project file is named:
VbaProject.otm
Outlook supports one VBA project at a time. Because the project is stored locally, your macro will not automatically appear on another computer when you sign in to the same Microsoft account.
5. Run the macro
- Select Developer.
- In the Code group, select Macros.
- Select the macro under Macro name.
- Select Run.
For the sample macro, Outlook displays a message box containing “This macro is running.”
The Macro dialog also provides these useful commands:
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minute| Command | What it does |
|---|---|
| Run | Runs the selected macro. |
| Step Into | Starts the macro in the VBA editor and executes it one line at a time. |
| Edit | Opens the selected procedure in the VBA editor. |
| Create | Creates a new macro. |
| Delete | Removes the selected macro. |
| Cancel | Closes the dialog without running a macro. |
6. Configure Outlook macro security
Outlook may block macros depending on its Trust Center settings.
- Select File > Options.
- Select Trust Center.
- Select Trust Center Settings.
- Select Macro Settings.
Common options include:
- Disable all macros without notification
- Disable all macros with notification
- Disable all macros except digitally signed macros
- Enable all macros
For a personal macro, Disable all macros with notification is generally the safer choice. It prevents macros from running silently while allowing you to recognize and permit trusted code when appropriate.
Rank #3
- KEYBOARD: The keyboard works for Windows with hot keys that enable easy access to Media, My Computer, Mute, Volume up/down, and Calculator
- EASY SETUP: Experience simple installation with the USB wired connection
- VERSATILE COMPATIBILITY: This keyboard is designed to work with multiple Windows versions, including Vista, 7, 8, 10 offering broad compatibility across devices.
- SLEEK DESIGN: The elegant black color of the wired keyboard complements your tech and decor, adding a stylish and cohesive look to any setup without sacrificing function.
- FULL-SIZED CONVENIENCE: The standard QWERTY layout of this keyboard set offers a familiar typing experience, ideal for both professional tasks and personal use.
Enable all macros is not a general troubleshooting fix. It can allow potentially dangerous code to run without confirmation. Also note that macro settings are application-specific: changing the setting in Excel does not change Outlook’s setting.
If the controls are unavailable or your changes do not persist, your organization may be enforcing macro security through policy. Contact your administrator rather than attempting to bypass the policy.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
7. Add the macro to the Quick Access Toolbar
You can run a frequently used macro without opening the Developer tab each time.
- Select File > Options.
- Select Quick Access Toolbar.
- In Choose commands from, select Macros.
- Select your macro.
- Select Add.
- Optionally select Modify to choose an icon and display name.
- Select OK.
The macro button will appear on the Quick Access Toolbar in Outlook.
8. Add the macro to the Outlook ribbon
For a more visible command, add the macro to a custom ribbon group.
- Open File > Options.
- Select Customize Ribbon.
- Select an existing tab, or select New Tab.
- Select New Group if you need a dedicated group for macros.
- Under Choose commands from, select Macros.
- Select the macro and choose Add.
- Select Rename if you want to change its display name or icon.
- Select OK.
Ribbon customizations are application-specific. A macro button added to Outlook will not automatically appear in Word or Excel.
9. Create an event-driven Outlook macro
Not every macro is launched manually. Event procedures run when something happens in Outlook, such as the application starting or new mail arriving.
Rank #4
- Fluid Typing Experience: Laptop-like profile with spherically-dished keys shaped for your fingertips delivers a fast, fluid, precise and quieter typing experience
- Automate Repetitive Tasks: Easily create and share time-saving Smart Actions shortcuts to perform multiple actions with a single keystroke with the Logi Options+ app (1)
- Smarter Illumination: Backlit keyboard keys light up as your hands approach and adapt to the environment; Now with more lighting customizations on Logi Options+ (1)
- More Comfort, Deeper Focus: Work for longer with a solid build, low-profile design and an optimum keyboard angle that is better for your wrist posture
- Multi-Device, Multi OS Bluetooth Keyboard: Pair with up to 3 devices on nearly any operating system (Windows, macOS, Linux, Googlebook OS) via Bluetooth Low Energy or included Logi Bolt USB receiver (2)
Application-level event code belongs in ThisOutlookSession, not in a standard module. To create a startup event:
- Select Developer > Visual Basic.
- In Project Explorer, double-click ThisOutlookSession.
- In the left object list above the code window, select Application.
- In the right procedure list, select Startup.
- Enter the event code.
Private Sub Application_Startup()
MsgBox "Outlook has started."
End Sub
Save the project and restart Outlook to test an application startup event. This procedure normally does not appear in the regular Macro dialog because it is a private event handler triggered by Outlook.
Events for other Outlook objects require an object variable declared with WithEvents, along with initialization code. They are more involved than a manually run Public Sub.
Common problems and fixes
The Developer tab is missing
Check File > Options > Customize Ribbon and enable Developer. If the check box is not available, you may be using new Outlook or Outlook for Mac, neither of which supports Outlook VBA macros.
The Macros command or Create button is missing
These commands are available in classic Outlook. They are not available in new Outlook. Switch to classic Outlook if it is installed, or install it separately.
My macro does not appear in the Macro dialog
Check each of these points:
- The code is in a standard module.
- The procedure is declared
Public. - It is a
Sub, not aFunction. - The procedure is not inside
ThisOutlookSession, a class module, or a form module. - The name contains no spaces.
- The code has no syntax errors.
- The VBA project is saved and allowed by macro-security settings.
The code runs from the editor but not from the Macro dialog
The procedure probably is not a listed macro. Move manually run code to a standard module and declare it as a Public Sub.
The event macro never runs
Confirm that the event procedure is in ThisOutlookSession, that its name and signature are correct, and that the project is saved. Restart Outlook when testing startup or application-level events. Macro security can also prevent the code from running.
Best Value
- 【Lag-free & Efficient】Stable and reliable connection of wireless keyboard and mouse is up to 10m(33ft). This combo share a nano USB receiver, no need to take up additional USB ports (Also the wireless keyboard and mouse can also be used separately). Plug and play, no software needed,convenient and efficient.
- 【Quiet & Type in Comfort】Wireless keyboard come with adjustable height tilt legs to increase comfort and prevent your wrists injury when typing for a long time.Our wireless keyboard adopts a silent structure. Soft membrane keys provide a quiet and comfortable typing experience.The wireless mouse is quiet without any clicking sound also.So whether at home or in the office, you can use this combo as you please without worrying about disturbing others.
- 【Full Size Keyboard】This keyboard saves desktop space while retaining its full size.The full size wireless keyboard with numeric keypad and 12 multimedia shortcut keys, such as play/ pause, volume increase and decrease, and search, to help you improve work efficiency.
- 【Auto Power Saving Function】Wireless keyboard and mouse have a smart auto-sleep mode to save power for long battery life. They will enter sleep mode after stop using a while(Refer to the instructions for details). Unplug the receiver or after the PC shutdown, they will enter sleep mode too.You can press any keys to wake. (battery life may vary based on user and computing conditions)
- 【Comfortable Optical Mouse】This silent wireless mice provides 3 adjustable DPI (800/1200/1600) to meet your different needs in terms of sensitivity.The compact lightweight design of wireless mouse and a hand-friendly contoured shape for all-day comfort, and smooth, precise tracking. Very suitable for office and daily use.
The VBA code turns red
Red text usually indicates a syntax problem. Look for an unmatched quotation mark, invalid characters, a malformed declaration, or a missing End Sub. Do not delete ThisOutlookSession simply because the editor highlights code.
Outlook displays security prompts
Some automation code can trigger Outlook Object Model Guard warnings, especially when it accesses address information, reads Outlook data in a sensitive context, or sends messages programmatically. Do not disable all programmatic-access warnings as a routine fix. Review the code and use an approved, controlled configuration if your organization requires automation.
The macro disappeared after moving to another computer
Back up or transfer the Outlook VBA project file, VbaProject.otm, from %AppData%MicrosoftOutlook, or export and import individual VBA modules. Outlook VBA was designed primarily as a personal macro-development environment, not as a packaged distribution format. Always keep a separate backup of important code.
FAQ
Can I create a VBA macro in new Outlook for Windows?
No. VBA macros are supported in classic Outlook for Windows, but not in new Outlook for Windows.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Can I create an Outlook VBA macro on a Mac?
No. Outlook for Mac does not support Outlook VBA macros.
Where should I put an Outlook macro?
Put a manually run macro in a standard module as a Public Sub. Put application event procedures, such as Application_Startup, in ThisOutlookSession.
Where does Outlook save macros?
Outlook normally saves its VBA project in %AppData%MicrosoftOutlookVbaProject.otm.
Why is my macro missing from the Macros dialog?
The procedure may be private, a Function instead of a Sub, or located in ThisOutlookSession, a class module, or a form module. Move it to a standard module and declare it as Public Sub.
Recommended Free Tools
Should I enable all Outlook macros?
No. Enabling all macros is potentially unsafe. Use a notification-based setting where possible and run only code you trust.
The Bottom Line
To create an Outlook VBA macro, use classic Outlook for Windows, enable Developer, choose Developer > Macros > Create, and place a Public Sub in a standard module. Save the project, configure macro security carefully, and run it from the Macros dialog or a custom toolbar button. Use ThisOutlookSession only for Outlook event procedures.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

