Log in

View Full Version : Move Mail to folder based on Category



ajc1616
01-09-2017, 01:13 PM
Hello,

My job requires me to keep track of my incoming e-mails. I have rules set up that if it has specific wording it gets categorized red as "Bid due" and it gets put in a folder named "Bids" . After I do what I need to do with the email I change the category to blue as "Done". I want to then have that e-mail moved to my "Done" folder. Can someone help me come up with a script to do this? Also is there a way to remove the red category automatically after I change it to blue?

Thanks,

VBA Noob

skatonni
01-09-2017, 03:32 PM
Option Explicit

Private Sub SetCategoryDone_MoveToFolderDone()

Dim itm As mailItem

' Select the item
Set itm = ActiveExplorer.Selection(1)

' Replace existing category with Done
itm.Categories = "Done"

' Move to a folder directly under the default inbox
itm.Move Session.GetDefaultFolder(olFolderInbox).Folders("Done")

' Move to a folder buried deeper
' Add as many ".Folders("name of subfolder") as needed
' itm.Move Session.GetDefaultFolder(olFolderInbox).Folders("name of subfolder").Folders("Done")

End Sub