VBA Code Samples

This is a list of the 228 articles published on slipstick.com that contain VBA code samples. The newest code samples and most recently updated pages are listed first.

Use RegEx to extract text from an Outlook email message

Use RegEx to extract text from an Outlook email message

Getting text out of a message body isn't as hard as it sounds, provided there is something in the body to search on. For example, if you are looking for a tracking code in an email and it's always identified as "Tracking code:" , you can use VB functions or RegEx to get the string.

Published or updated on Sep 21, 2014
Use a macro to copy data in Outlook email to Excel workbook

Use a macro to copy data in Outlook email to Excel workbook

Use RegEx to copy text from an email message and insert it into an Excel workbook.

Published or updated on Sep 21, 2014
Fix the Outlook Folder Type after Exporting an IMAP Account

Fix the Outlook Folder Type after Exporting an IMAP Account

After importing IMAP folders to Personal Folders or an Exchange mailbox, messages in the imported folder are hidden.

Published or updated on Sep 21, 2014
Rename Exchange Mailbox and Account in Outlook 2013

Rename Exchange Mailbox and Account in Outlook 2013

How to rename Exchange account display names that are shown in the navigation pane and From field in Outlook 2013.

Published or updated on Sep 21, 2014
Warn before sending messages to the wrong email address

Warn before sending messages to the wrong email address

Do you accidently send messages to the wrong email address? You can use a VBA macro that checks the outgoing addresses before sending the message.

Published or updated on Sep 20, 2014
Batch Import Photos into Outlook Contacts

Batch Import Photos into Outlook Contacts

How to add photos to Outlook contacts, either by editing each contact or using VBA or a utility to add images to all contacts.

Published or updated on Sep 20, 2014
Assign a custom form to existing Outlook items

Assign a custom form to existing Outlook items

Use this VBA macro as an alternative to DocMessageClass for changing an Outlook item's message class.

Published or updated on Sep 19, 2014
Sort messages by Sender domain

Sort messages by Sender domain

How to sort email messages by domain. Although you can filter by domain simply by typing the domain name in the address field of the filter dialog, you need to use a macro to sort by domain.

Published or updated on Sep 18, 2014
Backup Calendar, Contacts, Tasks in an IMAP data file

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.

Published or updated on Sep 17, 2014
Make the Address Book show only e-mail addresses, not fax numbers

Make the Address Book show only e-mail addresses, not fax numbers

Outlook includes fax numbers in the address book because they are valid electronic addresses. You can hide fax numbers from the address book by using a macro or an addin.

Published or updated on Sep 15, 2014
Working with VBA and non-default Outlook Folders

Working with VBA and non-default Outlook Folders

How to use VBA to 'do something' in Outlook's non-default folders.

Published or updated on Sep 15, 2014
Copy new appointments to another calendar using VBA

Copy new appointments to another calendar using VBA

Use VBA to watch for new appointments added to the calendar and copy them to a second calendar. This is useful if you are syncing with a second calendar and only want some items synced. New: watch for updates to the original appointment and change the copied appointment.

Published or updated on Sep 15, 2014
Send an email when you add an appointment to your calendar

Send an email when you add an appointment to your calendar

How to use VBA to send an email to someone when a new appointment is added to your Outlook calendar.

Published or updated on Sep 15, 2014
Change Category when Task is marked Completed

Change Category when Task is marked Completed

Use the ItemChange event to run a macro when the value in a field is changed in Outlook. In this example, when a task is marked complete, the Category is updated.

Published or updated on Sep 15, 2014
Add the Age to a Birthday on Outlook's Calendar

Add the Age to a Birthday on Outlook's Calendar

How to add a person's current age to a birthday event on Outlook's Calendar using a macro.

Published or updated on Sep 12, 2014
Copy a Contact's Mailing Address

Copy a Contact's Mailing Address

Use a macro to copy a Contact's name and mailing address block to use in another program.

Published or updated on Sep 11, 2014
Always use Tasks, not Outlook's To-Do List

Always use Tasks, not Outlook's To-Do List

How to use VBA to always select the desired Task folder when you open the Tasks navigation pane.

Published or updated on Sep 11, 2014
Create Outlook Folders from a List of Folder Names

Create Outlook Folders from a List of Folder Names

How to use a macro to create Outlook folders from a list of folder names in a csv file.

Published or updated on Sep 9, 2014
Save selected email message as .msg file

Save selected email message as .msg file

A VBA code sample to save one or more selected messages to your My Documents folder as .msg files, using the received date and time as the filename.

Published or updated on Sep 6, 2014
View the BCC Addresses in an Outlook.com EAS Account

View the BCC Addresses in an Outlook.com EAS Account

Use a macro to display the BCC recipients in an Outlook.com account in Outlook 2013.

Published or updated on Sep 5, 2014