VBOffice

Free VBA macros for Microsoft® Outlook®. Get more than 100 ready-to-use scripts, or use the samples as a template for your own programming.

Category-Manager Category-Manager
With Category-Manager you can group your Outlook categories, share them with other users, filter a folder by category, automatically categorize new emails, and more. You can use the Addin even for IMAP.
New: Determine a Folder for Sent Items

Get some samples for how to save a sent message in another folder than the default Sent Items folder.

Last modified: 2017/10/27

Order by: ▲ Title  Date
Access an Email With CDO 1.21

Up to Outlook 2003 the CDO 1.21 library offered features you couldn't find in the Outlook object model.

Last modified: 2006/01/20

Access the Email Message Header

This sample creates a user defined property and adds the return path so you can see its value for each email in the folder list view.

Last modified: 2009/07/18

API Timer

A timer enables you to call your code at regular intervals.

Last modified: 2006/01/18

Archive Calendar Items

See how to build your own auto archiving for Outlook folders.

Last modified: 2007/02/07

Assign a Form to an Item

Tell Outlook to use your custom form instead of the default form to display an item.

Last modified: 2009/09/23

Assign Email Categories Before Sending

Check message properties before sending. This sample prompts you if you try to send an email without an assigned category.

Last modified: 2007/04/24

Automatically Categorize a New Appointment

For users of smartphones, for instance, that don't support categories see how to categorize every new appointment.

Last modified: 2009/09/23

Block Travel Times For Your Appointments

This macro makes it easy to add, for instance, travel times for an appointment to the calendar.

Last modified: 2014/01/09

Bulk Edit Contacts

In this sample we change the company name for multiple contacts at once.

Last modified: 2016/12/06

Bulk Edit the Due Date for Multiple Task Items

In this sample we move the due date for several task items at one go.

Last modified: 2013/07/23

Bulk Edit the Priority for Multiple Task Items

In this sample we change the priority for multiple task items at once.

Last modified: 2008/01/15

Categorize Emails Automatically

Let a script categorize every new email.

Last modified: 2007/02/01

Change the Font of a Folder View

Do you want to change the view font of the current folder? This example works for Outlook 2007 and up.

Last modified: 2012/02/22

Check Email Size Before Sending

Get a prompt if the size of an email exceeds a certain limit.

Last modified: 2006/01/18

Color Label for Calendar Items

For Outlook XP and 2003 appointments could be labeled - but not via the Outlook object model. See how to set a color label by code.

Last modified: 2007/05/02

Confirm an Appointment by Email

Right click an appointment in your calendar, and send a confirmation to its linked contacts.

Last modified: 2010/08/24

Confirm Before Moving an Appointment

Never again accidentally drag an apppointment to another day, or time by using this macro.

Last modified: 2014/10/02

Copy Contacts from Access to Outlook

With a few lines of code you can copy recordsets from an Access database to Outlook.

Last modified: 2015/08/06

Copy Folder Structure

This sample copies Outlook folders without their contents.

Last modified: 2017/06/28

OLKeeper OLKeeper
OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or e-mails.
Copy Multiline Addresses

This VBA sample copies multi-line text, for instance the mailing address from an email signature, as a single line into the clipboard.

Last modified: 2015/08/14

Create a New Commandbar with one Button

A sample for how to create a your own toolbar in Outlook 2007 (or earlier) with command buttons.

Last modified: 2006/01/20

Create a New Journal Item Based on an Existing One

This macro makes it easy to create repeating journal items, for instance, when you often work on the same project.

Last modified: 2007/04/03

Create a Redemption SafeMailItem

The SafeMailItem of the Redemption library allows you to access properties of an email that are blocked by Outlook's security.

Last modified: 2006/05/21

Create a Serial Number

This sample creates a serial number, which you could use, for instance, to index task items.

Last modified: 2006/01/20

Create a Set of Subfolders

For a project based filing system you often have to create the same subfolders for every new project folder. You can create any number of subfolders at once with a macro.

Last modified: 2015/05/06

Create Automatically Follow-Up Tasks

This simple pattern demonstrates how to automatically create a new task as soon as the previous one is flagged as complete.

Last modified: 2016/11/26

Create Automatically New Journal Items for Calls

This sample adds every outgoing call to the journal.

Last modified: 2007/11/22

Create Distributionlist for a Contact Category

Categories are very good for managing your contacts. However, in some cases it might also be good to have the contacts of a given category in a mailing list, which can can used quickly as recipients for an email.

Last modified: 2015/03/12

Creating Nested Distribution Lists

Nested distlists allow to combine groups of contacts to another group.

Last modified: 2008/01/08

Delete Email Follow-up Flag when Completed

The script completely removes the flag once the item is completed.

Last modified: 2007/03/15

Delete Multiple Attachments at Once

Remove the attachments of several selected emails in one go.

Last modified: 2012/08/08

Delete Original Email When Replying

By clicking on Reply you can automatically delete the original email.

Last modified: 2006/09/26

Delete the Read Email And Open the Next One

See how to open the next email and delete the one you've just read.

Last modified: 2007/01/08

Deleting Reminders of Meeting Requests

Are you bothered if every incoming meeting request has a reminder set? This sample deletes the reminder as soon as the request comes in.

Last modified: 2007/08/17

Determine a Folder for Sent Items

Get some samples for how to save a sent message in another folder than the default Sent Items folder.

Last modified: 2017/10/27

Determine the Cursor Position

Since Word's object model is available in Outlook you can set the cursor to a certain position in a message.

Last modified: 2011/03/24

Directly Enter a Category Name

Before Outlook 2007, you could directly add a category to an item without saving it to the master category list. For Outlook 2007 and up this macro gives you that feature back.

Last modified: 2009/12/15

Display Categorizer for Outgoing Emails

Since Outlook 2007 you can't directly display the categorizer for outgoing e-mails. This sample demonstrates how to display the dialog by code, which works even for IMAP messages.

Last modified: 2008/10/13

ReplyAll ReplyAll
ReplyAll alerts you before unintentionally replying all, or if you are a confidential BCC recipient of the e-mail.
Display Options Dialog Before Sending

This sample opens the options dialog before sending an email so you can change some settings, for instance, delay the sending.

Last modified: 2006/01/19

Display the Email Address of the Recipient

Often the display name of an email recipient changes, making it impossible to sort these emails. This macro creates a new field with the pure email address.

Last modified: 2016/12/17

Display the Sender Address in Outlook 2000

This macro enables you to get the sender's address even in older versions of Outlook.

Last modified: 2006/05/05

Edit a Folder View

See how to edit the view settings of a folder.

Last modified: 2009/11/18

Edit Subject

See how to edit quickly the subject of received emails.

Last modified: 2016/10/01

Edit the Internet Format for a Contact

This macro allows you to determine the format (plain, html, rtf) to be used for sending emails for each of the three email addresses of a contact.

Last modified: 2006/09/11

Edit the List of Recipients Before Sending

This macro removes some addresses from an email before it leaves your outbox.

Last modified: 2010/02/20

Embed Pictures in an Email

These vba macros show how to embed a picture in an email so the receiver can see it instead of the dreaded red x.

Last modified: 2015/08/24

Empty a Folder

Delete the content of a folder with a single click.

Last modified: 2017/01/10

Execute Code When a Task is Completed

Often certain actions should take place as soon as one task is done. This sample demonstrates the general approach.

Last modified: 2007/04/13

Expand All Folders

This sample expands your entire folder list.

Last modified: 2017/03/17

Expand the Subfolder When a New Message Arrives

Do you sometimes miss a new email because it's automatically moved to a closed subfolder? This macro expands the subfolder so you can see at a glance whether is has new items.

Last modified: 2013/05/23

Export Email Addresses

These samples export the sender addresses or the recipient addresses of selected emails.

Last modified: 2017/04/28

Find a Folder by its Name

Don't remember where to find a given folder? With this script you can find the folder by its name.

Last modified: 2016/09/09

Find a Window by the Win32 Api

This demonstrates how to get a window handle by the Win32 API.

Last modified: 2006/02/05

Find Address in CC and Move the Email

This sample finds an address in the list of recipients and then moves the email.

Last modified: 2009/11/23

Find Emails of The Same Topic

Use VBA to search for all emails of the same topic.

Last modified: 2017/01/26

Flag a Contact For Follow-Up

With VBA is's possible to flag even contacts for follow-up and set a reminder.

Last modified: 2006/01/19

Flag an Email for Follow-up

This demonstrates how to flag emails for follow-up.

Last modified: 2016/11/03

Reporter Reporter
VBOffice Reporter is an easy to use tool for data analysis and reporting in Outlook. A single click, for instance, allows you to see the number of hours planned for meetings the next month.
Get the Default Email Account

A VBA macro that tells you which of all the available email accounts is the default one.

Last modified: 2006/11/09

Get the Message Folder

Where is the message stored you're looking at? This macro tells you and can even open the folder for you.

Last modified: 2008/06/08

Get the Outlook Version

This macro tells you which Outlook version is running.

Last modified: 2014/01/01

Get the Receiving Account

This macro tells you by which of your accounts a certain message was received.

Last modified: 2006/05/17

GetSelectNamesDialog Pre-fill Search Box

Do you want to add some convenience for your users? See how to fill-in the search box of the address book by code.

Last modified: 2016/11/21

Hide Commandbar at Startup

Control by code which of the commandbars should be visible at startup.

Last modified: 2009/08/15

Hide Text in Email

You can hide a text in an email by using a bookmark.

Last modified: 2016/05/25

How Many Appointments Do You Have Today?

The sample gets you the number of appointments or meetings of a given day.

Last modified: 2006/01/20

Insert a Formatted Excel Table into an Email

A sample for how to paste a table from Excel and retaining its formattings.

Last modified: 2007/01/29

Inspector Wrapper: Receive Events of Multiple Emails

Use an inspector wrapper if you need to subscribe to the events of multiple open messages.

Last modified: 2007/04/04

Join Appointment Item with Contact Data

This sample demonstrates how to look up a contact you have a meeting with, and display its mailing address with the appointment item.

Last modified: 2015/09/07

Join Email with Contact Data

This sample demonstrates how to look up the sender of an email and display its contact data in the inbox.

Last modified: 2015/03/30

Limit the Size of Loops

There could be a limit of how many items you can access in a single loop. See how to handle that situation.

Last modified: 2006/12/02

Link a Contact Item to Other Items

This sample explains the Links property, which is used to join any item (task item, contact item, etc.) with other items.

Last modified: 2014/02/26

Looping Recursively Through Folders and Subfolders

These samples demonstrate the basics for a recursive loop through folders and their subfolders.

Last modified: 2015/03/28

Make a Form of Your Own Modal Against Other Processes

This macro prevents users from working in another program while your program is waiting for an input.

Last modified: 2006/02/05

Making Attachment Name the Message Subject

See how to display automatically the name of an attachment as the subject of the message.

Last modified: 2016/11/25

Mark Calendar Items Read/Unread

With a VBA macro all types of items like appointments, or contacts can be marked read, or unread.

Last modified: 2014/05/23

Mark Emails Automatically as Read

This sample demonstrates how to mark an e-mail as read as soon is it's being copied or moved to a folder.

Last modified: 2008/09/15

ReplyAll ReplyAll
ReplyAll alerts you before unintentionally replying all, or if you are a confidential BCC recipient of the e-mail.
Merge Email Conversations

This sample shows how to merge any emails to the same conversation.

Last modified: 2016/10/27

Move Completed Emails

This sample demonstrates how to move an item automatically to a subfolder of the inbox as soon as you flag it as completed.

Last modified: 2006/01/18

Move Emails To The Junk Folder

This sample automatically moves empty emails to the junk folder.

Last modified: 2017/06/23

NewInspector and Inspector_Activate

Some emal properties cannot yet be changed in the Newinspector event. See how to handle that situation.

Last modified: 2007/03/20

Open and Save Files

A sample for how to read and write the content of any file.

Last modified: 2006/01/20

Open Custom Form via your own Ribbon

With a button for your templates you can open them with less clicks.

Last modified: 2010/10/13

Open Excel File from within Outlook

Open frequently used files with a single click directly from Outlook.

Last modified: 2015/08/01

Open Selected Items

This is a macro to open all selected items.

Last modified: 2017/01/31

Outbox does not send

Do you know the problem that an email doesn't leave the outbox? This macro addresses one of the reasons.

Last modified: 2015/09/21

Pause Code Execution

In Excel there's a function to stop the code execution for a determined time, which is missing in Outlook. See how to use the Sleep function of the Win32 API.

Last modified: 2007/07/20

Place the Cursor Into a Message

Via the Outlook object model you cannot set the focus to a specific control. This sample demonstrates how to do it with the Win32 API.

Last modified: 2006/01/30

Print Attachments Automatically

See how to print automatically the attachments you receive. A second sample shows how to print the attachments of all selected emails.

Last modified: 2017/09/11

Print Auto-Archive Settings

See how to create a list of the auto-archive settings for all your Outlook folders and subfolders.

Last modified: 2016/12/21

Print Emails Automatically

This sample prints every new email.

Last modified: 2007/03/24

Print First Page of an Email

This example demonstrates how to print just certain pages instead of the entire e-mail.

Last modified: 2015/10/12

Prompt for Missing Subject Before Sending

Another sample for how to check for certain properties before sending an email.

Last modified: 2008/06/19

Purge Deleted IMAP Messages

See how to really delete IMAP messages with a single click.

Last modified: 2008/02/19

Reactivate Task Reminders

This macro turns reminders of task items on.

Last modified: 2007/02/26

Remove Brackets from Call Number

Outlook 2013 adds automatically brackets around the area code. This script deletes the brackets.

Last modified: 2015/03/10

OLKeeper OLKeeper
OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or e-mails.
Remove the Quotation Marks from a Sender

Two examples for how to remove troublesome quotation marks or an apostrophe from an email address.

Last modified: 2016/01/05

Reply to an Email With a Template

This sample explains the basics for replying with a template.

Last modified: 2006/01/19

Request an Email Read Receipt

See how to request a read receipt based on the recipient of the message.

Last modified: 2008/11/19

Rule Assistent and Lower Cases

If you create a rule to move a new email automatically to another folder, the rules wizzard ignores upper/lower cases. This script doesn't ignore the subtle distinction.

Last modified: 2015/03/14

Run Rules Now

Rules can be run manually, however, that requires lots of clicks. Use this script to run all rules with your preferred settings.

Last modified: 2015/05/07

Run-a-Script Rule

This explains the basics for writing macros that can be run by a rule.

Last modified: 2006/12/11

Save Emails to the File System

The sample saves incoming emails as *.msg files to the file system.

Last modified: 2006/01/19

Save Multiple Attachments to the File System

This sample saves the attachments of all selected emails to the file system.

Last modified: 2012/07/29

Search Address in To Field and Run a Rule

Outlook can run a rule if you are the only recipient of an email. This macro runs a rule if you are the only recipient in the To field, no matter how many other addresses there is in the CC field.

Last modified: 2015/07/24

Security Model, Part 1

Avoid security alerts when accessing blocked properties or sending an email.

Last modified: 2007/12/18

Security Model, Part 2

With this little trick you can send emails via Outlook from, for instance, Excel without raising the security prompt in Outlook.

Last modified: 2007/12/19

Send a Copy of Every Email to Yourself

This example sends a copy of each outgoing email to another address. The address is added as BCC so the recipient doesn't see that.

Last modified: 2009/11/17

Send a Word Document As an Attachment

See how to send a document from within Word without blocking the Outlook window.

Last modified: 2014/10/14

Send all Files of a Folder

See how to send all files of a folder as email attachments to a predetermined recipient.

Last modified: 2015/05/11

Send an Email Template

This sends not the draft itself but a the copy of it so you can reuse the draft.

Last modified: 2017/02/25

Send and Delete Email

Send particular emails without saving a copy in your Sent Items folder.

Last modified: 2006/12/06

Send Delay

See how to defer the delivery of your emails. Instead of sending immediately, you could send your emails, for instance, in the evening at six o'clock.

Last modified: 2016/12/01

Send Emails Automatically

See how to send emails automatically and regularly at certain intervals.

Last modified: 2006/01/19

Send New Appointments Automatically by Email

Get a notification by email as soon as someone adds an appointment to your calendar.

Last modified: 2006/11/10

ReplyAll ReplyAll
ReplyAll alerts you before unintentionally replying all, or if you are a confidential BCC recipient of the e-mail.
Show the Member Count of a Distribution List

This script reveals how many member a given distribution list has.

Last modified: 2006/12/03

Sort Contacts by Birthday

This script creates a birthday list correctly sorted by day and month, and ignoring the year of birth.

Last modified: 2013/02/01

Suggest Email Addresses

This macro supports an advanced suggestion of email addresses. Find addresses not only by the first letters, but also by the domain, for instance.

Last modified: 2015/06/11

Trigger Actions With Categories

Categories qualify very well for triggering certain actions. See how to build your own Quick Steps.

Last modified: 2016/11/02

Use a Word Macro in Outlook

Outlook doesn't have a macro recorder, however, you can use many of the macros recorded in Word in Outlook, too.

Last modified: 2012/09/06

▲ Top