• Outlook User
  • Exchange Admin
  • Office 365
  • Outlook Developer
  • Outlook.com
  • Outlook Mac
  • Outlook & iCloud
    • Common Problems
    • 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
delete appointments

Delete Old Calendar Events using VBA

I have a Days of the Year HOL file that creates all day events that count the days of the year, up and down "Day 5: 360 to go" but as the days are past, I don't need to know what day it was and prefer a cleaner calendar. While it's easy enough to delete  

The hidden property is added and the folder is not visible in the folder list

How to Hide or Delete Outlook's Default Folders

Step-by-step instructions you can use to delete or hide the default folders (such as the junk email and suggested contacts folders) that Microsoft Outlook creates in your data files.

print a folder list in Outlook

Print a list of your Outlook folders

How to create a list of the folders in Microsoft Outlook data files. This code works with any data file in the Outlook profile.

Contact photo

Export (Save) Outlook Contact Photos

Use VBA to export a photo from a contact and save it to the hard drive. Use a second macro to add the photo to a new contact.

Powershell showing folder creation time

Use PowerShell or VBA to get Outlook folder creation date

Use PowerShell or VBA to get the creation date of a folder in Outlook desktop software.

Resend message command

Macro to Resend Sent Message

How to use a macro to resend a sent message in Outlook 2013 and Outlook 2016.

bulk change the display name field

Use PowerShell to Bulk Change Contacts

How to use PowerShell to bulk change Outlook Contact fields, including the File As and Email display name fields.

ItemSend macro

Add a keyword to the subject of all messages sent

Use VBA to check the subject of every message you send (new or replies) for a specific keyword. If the word is not found, add it to the subject.

Working with All Items in a Folder or Selected Items

These samples contains the basic code for working with all items in a selected folder or selected items in a folder.

new outlook icon

Using VBScript in Outlook Development

The code behind Microsoft Outlook forms is always written with the Microsoft Visual Basic Scripting Engine, better known as VBScript, a small portable language, which is also used in web pages and standalone scripts. VBScript does not support the built-in Outlook constants, such as olFolderContact. Only the constants built into VBScript, such as vbYes, are supported. For  

Use VBA to Create a List of Exchange GAL Members

Use an Outlook macro to create a list of users in the Exchange Global Address List or a list of member of a distribution group in the GAL.

Contact forms properties

How to Set a Custom Form as the Default for a Folder

You can easily change the default form used for new items for any folder type except Mail folders. Although the screenshots are for contacts, the steps are the same for Calendar & Tasks. Right click on the folder name and choose Properties. Then select the new form from the General tab, When posting to this  

Template warning

How to Open Outlook Templates and Files using Toolbar Buttons

How to create a toolbar button in Outlook 2007 or Outlook 2010 to open templates and files and disable the security warning dialog that displays before the template or files opens.

Combine and Print Multiple Outlook Calendars

How to copy appointments from several Outlook calendars to print as one calendar. Includes code specific to Exchange server accounts that works with Resource calendars as well as other user's calendars.

Remove [External] from Message Subject

A user wanted to know how to remove [External] from the subject of incoming messages. My company recently instituted the policy that puts the [EXTERNAL] tag in every subject when an email is received from outside the organization. When it's only one email, it's not really an issue. However, when it turns into a thread  

Next Page »

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

Latest EMO: Vol. 28 Issue 1

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
  • WeekMonthAll
  • Adjusting Outlook's Zoom Setting in Email
  • How to Remove the Primary Account from Outlook
  • Outlook's Left Navigation Bar
  • Create rules that apply to an entire domain
  • Save Sent Items in Shared Mailbox Sent Items folder
  • Use PowerShell to get a list of Distribution Group members
  • Outlook Auto Account Setup: Encrypted Connection not available
  • View Shared Calendar Category Colors
  • Move an Outlook Personal Folders .pst File
  • Run-a-Script Rules Missing in Outlook
  • Reset the New Outlook Profile
  • Delete Old Calendar Events using VBA
  • Use PowerShell or VBA to get Outlook folder creation date
  • Outlook's Left Navigation Bar
  • Contact's Display Bug
  • Use PowerShell to get a list of Distribution Group members
  • Edit Outlook’s Attach File list
  • Outlook Error: Google Couldn't sign you in
  • Error: Message archive has reached maximum size
  • New Outlook for Windows
Ajax spinner

Newest Code Samples

Delete Old Calendar Events using VBA

Use PowerShell or VBA to get Outlook folder creation date

Rename Outlook Attachments

Format Images in Outlook Email

Set Outlook Online or Offline using VBScript or PowerShell

List snoozed reminders and snooze-times

Search your Contacts using PowerShell

Filter mail when you are not the only recipient

Add Contact Information to a Task

Process Mail that was Auto Forwarded by a Rule

Recent Bugs List

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

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

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.

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

Other Microsoft 365 applications and services




Windows 10 Issues

  • iCloud, Outlook 2016, and Windows 10
  • Outlook Links Won’t Open In Windows 10
  • Outlook can’t send mail in Windows 10: error Ox800CCC13
  • Missing Outlook data files after upgrading Windows?

Outlook Top Issues

  • The Windows Store Outlook App
  • The Signature or Stationery and Fonts button doesn’t work
  • Outlook’s New Account Setup Wizard
  • Outlook 2016: No BCM
  • Exchange Account Set-up Missing in Outlook 2016

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

Contact Tools

Data Entry and Updating

Duplicate Checkers

Phone Number Updates

Contact Management Tools

Diane Poremsky [Outlook MVP]

Make a donation

Calendar Tools

Schedule Management

Calendar Printing Tools

Calendar Reminder Tools

Calendar Dates & Data

Time and Billing Tools

Meeting Productivity Tools

Duplicate Remover Tools

Mail Tools

Sending and Retrieval Tools

Mass Mail Tools

Compose Tools

Duplicate Remover Tools

Mail Tools for Outlook

Online Services

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

Outlook Suggestion Box (UserVoice)

Slipstick Support Services

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 | Advertise | Slipstick Forums
Submit New or Updated Outlook and Exchange Server Utilities

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