VBA Code Samples

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

Outlook Categories, Flags, and IMAP Accounts

Outlook Categories, Flags, and IMAP Accounts

Categories and flags are not available in all of my folders in Microsoft Outlook. I can use categories and flags on mail in my POP3 account but categories are not available in my IMAP account and flags are limited to one flag, no reminder. Why? The IMAP protocol doesn't support the Category and Flag properties  

Published or updated on Nov 24, 2014
Create a Task from an Email using a Rule

Create a Task from an Email using a Rule

Create tasks from email as they arrive using a simple script and Rules Wizard. With a slight variation, you can create a task from the message you are reading in the reading pane. Complete instructions and ready-to-use code samples included.

Published or updated on Nov 22, 2014
Print Contacts and Contact Photos

Print Contacts and Contact Photos

Use VBA to create a Word document containing the selected contact's name, address, phone number and contact photo.

Published or updated on Nov 21, 2014
Working with All Items in a Folder or Selected Items

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.

Published or updated on Nov 19, 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 Nov 16, 2014
Add BCM Account name to Contact's Company field

Add BCM Account name to Contact's Company field

A user decided the BCM was overkill for his needs and wanted to move his 5000 Business Contacts into Outlook Contacts before upgrading to Office 365. The only issue was keeping the contact associated with the Account name it was assigned to in BCM. The Company name field was suitable, but he needed to update  

Published or updated on Nov 16, 2014
Accept or decline a meeting request then forward or copy it

Accept or decline a meeting request then forward or copy it

Use a VBA macro in Outlook to save as an appointment or forward to another address before accepting or declining incoming meeting requests.

Published or updated on Nov 16, 2014
Combine and Print Multiple Outlook Calendars

Combine and Print Multiple Outlook Calendars

How to copy appointments from several Outlook calendars to print as one calendar.

Published or updated on Nov 15, 2014
Enable or disable an Outlook rule using reminders and VBA

Enable or disable an Outlook rule using reminders and VBA

Do you want Outlook to run certain rules during specific time periods, like only overnight, then turn them off when you are in the office? You can use VBA and task reminders to turn your rules off and on.

Published or updated on Nov 14, 2014
Run Rules Now using a Macro

Run Rules Now using a Macro

How to use a macro to run Outlook's rules on demand or triggered by a reminder.

Published or updated on Nov 14, 2014
Mail Merge to Email using an Outlook Macro

Mail Merge to Email using an Outlook Macro

Use an Outlook macro and a Word document containing merge fields to mail merge to email. You can even add an attachment to the message before sending.

Published or updated on Nov 12, 2014
Remove Prefix and Reformat Phone Numbers

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.

Published or updated on Nov 12, 2014
Create Tasks from Email and move to different Task folders

Create Tasks from Email and move to different Task folders

Use this macro to create tasks from email messages and move them to different task folders.

Published or updated on Nov 11, 2014
Developer Tools

Developer Tools

This is a collection of tools used to view inside MAPI message stores, including Exchange mailboxes and PSTs. Two of the tools, MFCMapi and MDBVu32 are provided by Microsoft. While these tools are designed for developers, they can be used by anyone with basic knowledge to browse for and delete hidden items in a mailbox  

Published or updated on Nov 7, 2014
Get Outlook's Internet Headers using VBA

Get Outlook's Internet Headers using VBA

Use this code sample and function to display the Internet header of selected message in a new message form.

Published or updated on Nov 7, 2014
Create a List of Rules

Create a List of Rules

Valk Beekman wanted to share this VBA code sample that creates a text file containing a list of the rules used by the default email account. When the rule contains an email address, the address (or display name) is added to the output.

Published or updated on Nov 6, 2014
Save Messages as *.DOC File Type

Save Messages as *.DOC 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.

Published or updated on Nov 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 Oct 31, 2014
Use a Macro to Assign Messages in a Shared Mailbox

Use a Macro to Assign Messages in a Shared Mailbox

How to use an Outlook macro to move messages to a new folder or mailbox or to assign categories to the message round-robin style.

Published or updated on Oct 31, 2014
Using a Gmail Master Account: Reply using the Correct Account

Using a Gmail Master Account: Reply using the Correct Account

How to configure Outlook so you can send email from other email addresses connected to a Gmail account.

Published or updated on Oct 30, 2014