The articles listed below contain VBA code samples. Additional code samples are listed at Developer Samples
![Use Default Sending Account](https://b76191.smushcdn.com/76191/images/2011/outlook-2010/2016-defaultsendingacct-110x110.png?lossy=2&strip=1&webp=1)
Outlook, Multiple Accounts and the Default Account
When you use Microsoft Outlook 2010 or Outlook 2013 and have multiple accounts delivered to different *.pst files, Outlook doesn’t use the default account set in Account settings. Instead, it uses the account associated with the mailbox or *.pst file the folder you are viewing is stored in. This change in behavior doesn't work well when an IMAP is configured to be the default email account and you have a POP3 account delivered to the default pst file.
![Create a rule to run a script](https://b76191.smushcdn.com/76191/images/2011/12/run-a-script-rule-110x110.png?lossy=2&strip=1&webp=1)
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.
![](https://b76191.smushcdn.com/76191/images/2012/04/outlook-new-mail-icon-110x110.png?lossy=2&strip=1&webp=1)
Send an Email When a Reminder Fires
Another entry in my Lazy Programmer Series, a macro for Outlook users who want to schedule a message to send later. This macro is triggered by a reminder and sends a message, composed from the appointment's subject line and body.
![](https://b76191.smushcdn.com/76191/images/2012/rules/change-subject-forward-110x110.png?lossy=2&strip=1&webp=1)
Run a Script Rule: Forwarding Messages
An Outlook user asked how to automatically change the subject of a message and forward it to another address. Using a "run a script" rule is one option and we show you how to do it.
![](https://b76191.smushcdn.com/76191/images/2011/outlook/right-right-view-categories-110x110.png?lossy=2&strip=1&webp=1)
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
![](https://b76191.smushcdn.com/76191/images/folders.png?lossy=2&strip=1&webp=1)
Shortcuts to open Outlook folders
Outlook doesn't support creating shortcuts to folder on the Quick Access toolbar (QAT) or ribbon, but you can put macro on the QAT or ribbon that opens a folder.
![Write the reminder and snooze list to a post form](https://b76191.smushcdn.com/76191/images/2021/outlook/reminder-list-110x110.png?lossy=2&strip=1&webp=1)
List snoozed reminders and snooze-times
How to use a VBA macro to list all snoozed times for Appointments, Flagged messages, and Tasks.
Warn Before Deleting a Contact
The code samples on this page ask for confirmation before a contact is deleted. This way you don't need to retrieve the contact from the Deleted items folder and move it back to the contacts folder. The first code sample works with selected contacts, the second one works with opened contacts. You can use both
![paste the powershell in the window](https://b76191.smushcdn.com/76191/images/2019/developer/paste-powershell-script-110x110.png?lossy=2&strip=1&webp=1)
Delete folders using a VBA Macro or PowerShell
Use an Outlook macro or PowerShell script to bulk delete folders from Outlook.
![](https://b76191.smushcdn.com/76191/images/2014/code-samples/imap-folder-properties-110x110.png?lossy=2&strip=1&webp=1)
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.
![](https://b76191.smushcdn.com/76191/images/2012/04/calendar-reminder-icon.png?lossy=2&strip=1&webp=1)
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.
![delete appointments](https://b76191.smushcdn.com/76191/images/2022/outlook/delete-days-featured-110x110.png?lossy=2&strip=1&webp=1)
Delete Old Calendar Events using VBA
I have a Days of the Year HOL file that creates all day events that count the days of the year, up and down "Day 5: 360 to go" but as the days are past, I don't need to know what day it was and prefer a cleaner calendar. While it's easy enough to delete
![Contact photo](https://b76191.smushcdn.com/76191/images/contact-photo-110x110.png?lossy=2&strip=1&webp=1)
Export (Save) Outlook Contact Photos
Use VBA to export a photo from a contact and save it to the hard drive. Use a second macro to add the photo to a new contact.
![Powershell showing folder creation time](https://b76191.smushcdn.com/76191/images/2022/outlook/powershell-get-folder-date-110x110.png?lossy=2&strip=1&webp=1)
Use PowerShell or VBA to get Outlook folder creation date
Use PowerShell or VBA to get the creation date of a folder in Outlook desktop software.
![Resend message command](https://b76191.smushcdn.com/76191/images/2016/outlook/resend-command-110x110.png?lossy=2&strip=1&webp=1)
Macro to Resend Sent Message
How to use a macro to resend a sent message in Outlook 2013 and Outlook 2016.