Code Samples

This category contains code samples put together to solve a specific user’s problem. The pages may not have detailed instructions for use.

Create a custom numbering field on Outlook messages

Create a custom numbering field on Outlook messages

How to create a custom index field on Outlook messages using numbers only or the mailbox name and numbers.

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.

Use a macro to create a rule to move messages

Use a macro to create a rule to move messages

How to run macros triggers by reminders, update rules using macros, and more.

Save and Rename Outlook Email Attachments

Save and Rename Outlook Email Attachments

Use a macro to save attachments on Outlook email messages to a folder on your hard drive and add the files last modified date to the filename.

Macro to Export Outlook Fields to Excel

Macro to Export Outlook Fields to Excel

Use a macro to write Outlook values to an Excel spreadsheet.

Macro to Copy an Outlook message to another folder

Macro to Copy an Outlook message to another folder

A user had this question: I want to do the following: 1. Copy a message from one public folder to another public folder 2. Mark the original message as read 3. Mark the original Complete 4. Add a Category to it A Quick Step will categorize the e-mail first (it has a higher priority) and  

Import meetings from a CSV or XLSX file

Import meetings from a CSV or XLSX file

Use a macro to import data from a CSV or Excel xlsx file to create meeting requests or appointments.

Use VBA to move messages with attachments

Use VBA to move messages with attachments

Use a run a script rule or an ItemAdd macro to look for messages with attachments. When the attachment is a specific file type, do something with the message.

How to use Windows filepaths in a macro

How to use Windows filepaths in a macro

How to choose the file path when you save an Outlook attachment or a message using a VBA macro.

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.