Outlook Move Old Emails | VBA Macro #7

Macro Intro

This Outlook macro makes cleaning out your inbox as easy as one click. The Move Old Emails macro will automatically move emails out of your inbox and into a different folder. Emails only move if they qualify for the criteria you set. (Example: The email is Read, has no Flags Marked, and No Categories set) No longer will you have to manually move old emails out of your inbox and make mistakes dragging emails to different folders. The Move Old Emails macro will do this for you allowing you to focus on what emails you have left. Spend more time in your inbox and get more done! This macro is easily customizable to meet your unique needs. ***Tip: The Move Old Emails macro can be scheduled to reoccur automatically on your Outlook Calendar using the Call action from the Outlook Calendar Reminder Macros.

See it in Action

Watch this video to see this macro in action.

Code

Here is the code for this macro. Make sure the following References are setup before running it: Visual Basic For Applications, Microsoft Outlook 16.0 Object Library

Insider Content

Here is the Insider code for this macro. With this macro you can use an Excel Workbook to easily loop through multiple Outlook email folders and use unique criteria for each folder to determine when emails should be moved. Simply create a Worksheet per Outlook email folder you want to loop through. The Worksheet Name is used to determine folder name so they must match. Within each Worksheet list out criteria that matters for each folder. If you want certain email criteria to be ignored make it a comment directly in the macro. Make sure the following References are setup before running it: Visual Basic For Applications, Microsoft Outlook 16.0 Object Library, Microsoft Office 16.0 Object Library, Microsoft Excel 16.0 Object Library

Customization

These segments of code can be customized to personalize this macro.
The StartFolder variable is used to determine which Outlook folder to loop through for emails to move. By Default the Start Folder is setup to be the default Outlook Account’s Inbox. You can adjust the Start Folder to be a different Outlook Account and even a different Outlook Folder. (See additional customization for more details)
This code line can be used to change the StartFolder variable to a different Outlook Account. Simply update “ACCOUNT NAME” with the Outlook Account’s Email Address. (Ex. “[email protected]”) By Default this Outlook Account will be looking to the Inbox.
This code line can be used to change the StartFolder variable to an Outlook Sub Folder underneath the Inbox. Simply update “SubFolder Name” with the Outlook Folder’s Name.
The EndFolder variable is used to determine which Outlook folder emails (that meet criteria) are sent too. By Default the End Folder is setup to be the default Outlook Account’s Deleted Items folder. You can adjust the End Folder to be a different Outlook Account and even a different Outlook Folder. (See additional customization for more details)
This code line can be used to change the EndFolder variable to a different Outlook Account. Simply update “ACCOUNT NAME” with the Outlook Account’s Email Address. (Ex. “[email protected]”) By Default this Outlook Account will be looking to the Deleted Items Folder.
This code line can be used to change the EndFolder variable to an Outlook Sub Folder. Simply update “SubFolder Name” with the Outlook Folder’s Name.
By Default this macro will start with the most recent email when looping through an Outlook folder. This behavior is controlled by the Sort method referencing the [ReceivedTime] property. Starting from the oldest or most recent email is determined by how the Descending parameter is set. If True start with the oldest. If False start with the most recent. To learn more about the Sort method look here!
This If Then Statement is used to determine if an email should be moved from the Start Folder to the End Folder. That determination is made by using the Outlook MailItem Object Properties to evaluate each email with specific criteria. Currently this macro is setup to only look for emails that are Read, have no Flag Status, and no Category set. To see more Outlook MailItem Properties available navigate here!
Search

First time using VBA?

The Developer Tab is an additional section of the ribbon when activated allows you access to Visual Basic in Applications like Access, Excel, Outlook, PowerPoint, Word.
Setup Now
Once the Developer Tab is available you will have the capability to update your security to allow Macros to run in the current application.
Setup Now
A sub of code is a collection of objects and variables. For the code to successfully run a library of references needs to be set.
Setup Now
Subscribe as an Insider to receive additional rights.
If you like our content and want to show your support tip us here!

Contact Us

Looking to improve your computer processes?
Leverage & Lean is here to help!

Powered By MemberPress WooCommerce Plus Integration

Free Macro

Start creating Less Clicks, More Results today!