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.

Apply a View to a Folder using a Macro

Apply a View to a Folder using a Macro

How to use an Outlook macro to apply a frequently used view to a folder instead of using the Change View command.

Published or updated on Oct 20, 2014

101 Samples for Office 2010 Development

Use these 101 samples to create your own Office applications that perform specific functions, or as a starting point to create more complex solutions. Each code sample consists of approximately 5 to 50 lines of code demonstrating a distinct feature or feature set in VBA. While most of the code samples are for Excel, Word, and Powerpoint, there are 4 samples for Outlook. There are also samples available for OneNote, Office, and Visio.

Published or updated on Oct 18, 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 Oct 14, 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 Oct 8, 2014
How to Change the Mapping Service used by Outlook's Map Link

How to Change the Mapping Service used by Outlook's Map Link

How to change the Map service that Outlook uses for the MapIt feature in Outlook Contacts to use your favorite map website.

Published or updated on Oct 2, 2014
Remove an Address from Reply All

Remove an Address from Reply All

Use a macro to remove your own addresses when using Reply All in Microsoft Outlook.

Published or updated on Oct 2, 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 Oct 2, 2014
Set an expiration date on all messages you send

Set an expiration date on all messages you send

How to use VBA to automatically add an expiration date to all messages you send using Microsoft Outlook.

Published or updated on Oct 1, 2014
How to Remove or Change the Reminder on All Day Events

How to Remove or Change the Reminder on All Day Events

While you can't change Outlook's 18 hour default reminder, you can use VBA to remove the reminder or change it to a different time. While the tweaks here work specifically with reminders on All Day events, this code can be tweaked to do almost anything when a new appointment or event is saved.

Published or updated on Sep 30, 2014
Macro to Print Outlook email attachments as they arrive

Macro to Print Outlook email attachments as they arrive

An updated macro to print Outlook email attachments as they arrive. This macro works with Outlook 2013 and older, 32 or 64-bit versions, with both 3 and 4 character Office file extensions.

Published or updated on Sep 30, 2014
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
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
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