• 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

Save and Delete Attachments from Outlook messages

The following is the Save Attachment code sample from Teach Yourself Outlook 2003 in 24 Hours. (It works in current versions.) Frank modified the code to break it into a single call for each mailĀ item so you can use it with a rule to filter incoming mail. Augusto modified Frank's code "in order to avoid  

paste into group calendar

How to Import Appointments into a Group Calendar

How to move or import appointments from an Outlook calendar into a Group Calendar.

room is full message

Close a Meeting When the Room is Full

A user had a request: an automated way of telling people a meeting full. It's not an unusual request, 3 or 4 people ask me how to do this each year. This time it sounded like a fun project to do. I am in charge of organizing meetings for my company (150+ people). However, depending  

Making the Journal work in Outlook 2013 and up

I'm going to begin this by saying that I really think it's time to find another solution for journaling. I have no idea how many more versions we'll see before Microsoft rips Journal's heart out. It's time to move on to something that is going to be around longer. On the other hand, it's possible  

Reply using the address a message was sent to

Use this code to send a new message using the address the selected message was sent to as the From account. This code is for people who use an account such as Gmail or Hotmail to collect mail from other accounts. Outlook will always reply using the account that downloaded the message, this code selects the send using account based on the address the message was sent to.

Macro to Move or Copy an Outlook message to another folder

A user had this question: I want to do the following: Copy a message from one public folder to another public folder Mark the original message as read Mark the original Complete Add a Category to it A Quick Step will categorize the e-mail first (it has a higher priority) and both the actual e-mail  

Create Outlook appointments for every nn workday

One (very justified) complaint about Outlook recurrence patterns is that there is not a pattern for Every xx weekday (Monday - Friday). You can create appointments for specific days of the week, but the every xx days pattern includes Saturday and Sunday. The solution: a macro that copies the appointment details to a new appointment.

Open multiple Outlook windows when Outlook starts

How to use VBA to automatically open up Outlook windows in a particular order (mail, calendar, contacts and tasks) with each in a specific size and screen position.

Calendar icon

Use a macro to open the Calendar to appointment date

Macro to replace the Go To Date feature of Outlook's Calendar. From an open appointment, run the macro. The calendar opens to the date of the appointment.

use a macro to change the time zone

Set most frequently used Appointment Time Zones

A visitor to our forums had a question about time zones: I regularly need to schedule events in Pacific and Eastern time. Is there a way to get rid of all the excess time zones? For example, I counted *six* different entries for UTC-5 (US eastern time). I get that there are places with weird  

Reply using word icon

Mail merge and Send from a Distribution Group

How to use a macro to mail merge to email, add attachments, and send the messages from a different email address.

Reminders are missing in Outlook Calendar

Outlook 2013 doesn't set a reminder when you open a new appointment form by double clicking on a date in the monthly calendar. Until Microsoft fixes this, you can use a macro to set the reminder.

Get Flag Completed Time

A visitor to Slipstick Forums had a problem: I need to count the inbound traffic by inbox/day and check whether the email was marked as complete (Flag Completed Date and Time). I can get the time when I copy and paste from a folder to Excel but there are a number of folders to process  

VBA: File messages by client code

The problem: a user needs to file messages from clients in a specific folder, which is the clients accounts number. Moving the messages manually is time consuming but using a macro makes it easy.

The phone format after running the macro

Remove Prefix and Reformat Phone Numbers

Outlook VBA code to remove the +1 country code prefix and reformat phone numbers in Outlook Contacts before syncing to a smartphone.

« 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.