How to Auto Move Emails with Different Color Categories to Different Folders in Outlook

If you wish Outlook to auto move emails to different folders when you assign different color categories to them, you can use the method introduced in this post.

Many users long for methods to auto move an email to a specific folder when a certain color category is assigned to it. Without any doubts, Outlook doesn’t offer such a direct feature to realize it. Therefore, in the followings, we will teach you a means to get it. Now, read on to get the detailed steps.

Auto Move Emails with Different Color Categories to Different Folders in Outlook

Auto Move Emails with Different Color Categories to Different Folders

  1. For a start, launch your Outlook program.
  2. Then, in Outlook, press “Alt + F11” key buttons to access VBA editor.
  3. Subsequently, put the following VBA code into “ThisOutlookSession” project.
Private WithEvents objInboxFolder As Outlook.Folder
Private WithEvents objInboxItems As Outlook.Items

'Process inbox mails
Private Sub Application_Startup()
    Set objInboxFolder = Outlook.Application.Session.GetDefaultFolder(olFolderInbox)
    Set objInboxItems = objInboxFolder.Items
End Sub

'Occurs when changing item
Private Sub objInboxItems_ItemChange(ByVal Item As Object)
    Dim objMail As Outlook.MailItem
    Dim objTargetFolder As Outlook.Folder
 
    If TypeOf Item Is MailItem Then
       Set objMail = Item
 
       'Move mails based on color category
       If InStr(objMail.Categories, "Private") > 0 Then
          Set objTargetFolder = Application.Session.GetDefaultFolder(olFolderInbox).Folders("Private")
          objMail.Move objTargetFolder
       ElseIf InStr(objMail.Categories, "Business") > 0 Then
          Set objTargetFolder = Application.Session.GetDefaultFolder(olFolderInbox).Folders("Business")
          objMail.Move objTargetFolder
       End If
    End If
End Sub

VBA Code - Auto Move Emails with Different Color Categories to Different Folders

Notes:

  • To process items in other folders, you can change the “objInboxFolder” object, like “Application.Session.GetDefaultFolder(olFolderSentMail)” for “Sent Items” folder.
  • Also, change the color categories and target folders predefined in the above code as per your actual cases.
  • Plus, you can use “ElseIf” to add the other optional color categories.
  1. After that, move the cursor in the “Application_Startup” subroutine and press “F5”, which will activate this macro.
  2. Finally, you can take a shot. Here is my example.
  • Select an email in Inbox folder.
  • Then, assign “Private” color category to it.Assign a Color Category to an Email
  • At once, this mail will be moved to the “Private” folder under “Inbox”.Email Being Auto Moved to a Specific Folder

Handle Your Outlook with Care

Maybe you have encountered several issues in your Outlook. More often than not, they actually occur from your improper handlings. For instance, you always close your Outlook incorrectly, such as sudden power down. Or you haven’t backed up your Outlook data at regular intervals. All similar actions can make your Outlook much more vulnerable. As you know, once a PST file gets damaged, it is extremely difficult to repair it. In general, the inbox repair tool won’t make effects. You have no choice but to take aid of external tip-top utilities, such as DataNumen Outlook Repair.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including recover sql and outlook repair software products. For more information visit www.datanumen.com

Comments are closed.