• Outlook User
  • New Outlook app
  • Outlook.com
  • Outlook Mac
  • Outlook & iCloud
  • Developer
  • Microsoft 365 Admin
    • Common Problems
    • Microsoft 365
    • Outlook BCM
    • Utilities & Addins

VBA Code Samples

Slipstick Systems

The articles listed below contain VBA code samples. Additional code samples are listed at Developer Samples

VBA Code Samples was last modified: February 8th, 2018 by Slipstick
Reference the Word object model in Outlook's VBA Editor

Use Word Macro to Apply Formatting to Email

How to use a VBA macro recorded in Microsoft Word to apply formatting in an Outlook email message.

How to change the From field on incoming messages

How to use Redemption to change the sender's name field on messages.

Save Messages as *.DOC or *.DOCX File Type

If you want to save messages in a universal format and want the attachments stay with the document, you need to convert the message to RTF format then save the message in *.doc format. . While you can do this in Outlook, it takes several steps. Using VBA to save messages to your hard drive in *.doc format takes just seconds.

Use VBA to move messages with attachments

Use a run a script rule or an ItemAdd macro to look for messages with attachments. When the attachment is a specific file type, do something with the message.

Copied folders

Backup Calendar, Contacts, Tasks in an IMAP data file

Use a macro to copy appointments, contacts, tasks, and notes to a *.pst file before removing an IMAP account from Outlook 2013.

Folder icon

Run a script rule: Autoreply using a template

Use a Run a Script rule to autoreply to a message using a template. Include the original message or reply to a web form-generated message.

Macros to send messages using a specific account

Macro samples to send messages from a specific email account or email address you have permission to send as.

How to use an ItemAdd Macro

An ItemAdd macro watches a specific folder and runs a macro on it as messages are dropped into it, using any method: using rules, dragging messages to the folder, using the move or copy to folder command, or even copy and paste in place.

Set a reminder when accepting a meeting request

Use VBA to open an Outlook meeting request that was just added to the calendar after accepting the request in the Inbox. so you can set a reminder or make notes.

Color Categories before and after importing

Use PowerShell to Export and Import Categories

How to use PowerShell to export, import or merge categories in different Outlook mailboxes.

Create a list of your categories and their assigned colors

Print a list of Outlook Categories and their Colors

How to use VBA to create a list of your Outlook categories and their assigned colors. For Microsoft Outlook 2007 and up.

new outlook icon

Add recurring travel appointments to recurring appointments

Add travel appointments before and after recurring appointments as recurring appointments. This code sample was written by Rory. I figured out how to create recurring appointments that match the recurrence pattern of my master appointment. Sub AddTravelToMeeting() Dim olItem As AppointmentItem, olItems As Outlook.Items Dim strTravelOut As String Dim strTravelBack As String Dim iTravelMinutesOut As  

new outlook icon

To automatically add recipients to Contacts in Outlook using VBA

One thing that Outlook cannot do by itself is automatically create new entries in Contacts for people you send messages to. This VBA code sample by Sue Mosher provides a way to add recipients automatically. To avoid the Outlook security prompts, it uses the Redemption library, which provides a wrapper for Extended MAPI that does  

Dismiss reminders for past calendar events

Two macros to remove reminder from appointments. The first macro removes the reminders as the appointment is created in a specific calendar folder. The other macro removes reminders from older items.

How to Create a Unified Inbox View

How to use create a Unified Inbox filter in Outlook 2010 or Outlook 2013 using VBA and a search query. Turn any frequently used search into a macro.

« Previous Page
Next Page »

Visit Slipstick Forums.
What's New at Slipstick.com

Latest EMO: Vol. 31 Issue 3

Support Services

Do you need help setting up Outlook, moving your email to a new computer, migrating or configuring Office 365, or just need some one-on-one assistance?

Our Sponsors

CompanionLink
ReliefJet
  • Popular
  • Latest
  • Week Month All
  • Jetpack plugin with Stats module needs to be enabled.
  • Error Opening iCloud Appointments in Classic Outlook
  • Opt out of Microsoft 365 Companion Apps
  • Mail Templates in Outlook for Windows (and Web)
  • Urban legend: Microsoft Deletes Old Outlook.com Messages
  • Buttons in the New Message Notifications
  • Move Deleted Items to Another Folder Automatically
  • Open Outlook Templates using PowerShell
  • Count and List Folders in Classic Outlook
  • Google Workspace and Outlook with POP Mail
  • Import EML Files into New Outlook
Ajax spinner

Recent Bugs List

Microsoft keeps a running list of issues affecting recently released updates at Fixes or workarounds for recent issues in classic Outlook (Windows).

For new Outlook for Windows: Fixes or workarounds for recent issues in new Outlook for Windows .

Outlook for Mac Recent issues: Fixes or workarounds for recent issues in Outlook for Mac

Outlook.com Recent issues: Fixes or workarounds for recent issues on Outlook.com

Office Update History

Update history for supported Office versions is at Update history for Office

Outlook Suggestions and Feedback

Outlook Feedback covers Outlook as an email client, including Outlook Android, iOS, Mac, and Windows clients, as well as the browser extension (PWA) and Outlook on the web.

Outlook (new) Feedback. Use this for feedback and suggestions for Outlook (new).

Use Outlook.com Feedback for suggestions or feedback about Outlook.com accounts.

Other Microsoft 365 applications and services




New Outlook Articles

Error Opening iCloud Appointments in Classic Outlook

Opt out of Microsoft 365 Companion Apps

Mail Templates in Outlook for Windows (and Web)

Urban legend: Microsoft Deletes Old Outlook.com Messages

Buttons in the New Message Notifications

Move Deleted Items to Another Folder Automatically

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Google Workspace and Outlook with POP Mail

Import EML Files into New Outlook

Newest Code Samples

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Insert Word Document into Email using VBA

Warn Before Deleting a Contact

Use PowerShell to Delete Attachments

Remove RE:, FWD:, and Other Prefixes from Subject Line

Change the Mailing Address Using PowerShell

Categorize @Mentioned Messages

Send an Email When You Open Outlook

Delete Old Calendar Events using VBA

Repair PST

Convert an OST to PST

Repair damaged PST file

Repair large PST File

Remove password from PST

Merge Two Data Files

Sync & Share Outlook Data

  • Share Calendar & Contacts
  • Synchronize two computers
  • Sync Calendar and Contacts Using Outlook.com
  • Sync Outlook & Android Devices
  • Sync Google Calendar with Outlook
  • Access Folders in Other Users Mailboxes

Diane Poremsky [Outlook MVP]

Make a donation

Mail Tools

Sending and Retrieval Tools

Mass Mail Tools

Compose Tools

Duplicate Remover Tools

Mail Tools for Outlook

Online Services

Calendar Tools

Schedule Management

Calendar Printing Tools

Calendar Reminder Tools

Calendar Dates & Data

Time and Billing Tools

Meeting Productivity Tools

Duplicate Remover Tools

Productivity

Productivity Tools

Automatic Message Processing Tools

Special Function Automatic Processing Tools

Housekeeping and Message Management

Task Tools

Project and Business Management Tools

Choosing the Folder to Save a Sent Message In

Run Rules on messages after reading

Help & Suggestions

Submit Outlook Feature Requests

Slipstick Support Services

Buy Microsoft 365 Office Software and Services

Visit Slipstick Forums.

What's New at Slipstick.com

Home | Outlook User | Exchange Administrator | Office 365 | Outlook.com | Outlook Developer
Outlook for Mac | Common Problems | Utilities & Addins | Tutorials
Outlook & iCloud Issues | Outlook Apps
EMO Archives | About Slipstick | Slipstick Forums
Submit New or Updated Outlook and Exchange Server Utilities

Send comments using our Feedback page
Copyright © 2026 Slipstick Systems. All rights reserved.
Slipstick Systems is not affiliated with Microsoft Corporation.