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.

Reply using the address a message was sent to

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.

Published or updated on Oct 24, 2014
VBA Sample: Do something when Reply is clicked

VBA Sample: Do something when Reply is clicked

How to "do something" when you click the Reply, Reply All, or Forward button. Add a category, change the subject, add a recipient, add boilerplate text.

Published or updated on Oct 24, 2014
Send an email to attendees who have not responded

Send an email to attendees who have not responded

A common question is how to send a message only to meeting invitees who have no yet responded to the meeting request. While Outlook doesn't include this feature, you can easily do this using VBA.

Published or updated on Oct 23, 2014
Using Windows environment variables in Outlook macros

Using Windows environment variables in Outlook macros

How to use a Windows operating-system Environ property environment variable in a macro to set or get file paths, such as to save attachments or email to the user's My Documents folder. (Works with Word and Excel macros too.)

Published or updated on Oct 23, 2014
Adding Birthdays and Anniversaries to Outlook's Calendar

Adding Birthdays and Anniversaries to Outlook's Calendar

Help managing Contact birthdays that are automatically added by Outlook to your calendar. Included are macros to added birthdays for imported contacts and to change the reminder time.

Published or updated on Oct 23, 2014
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