blueman124
New Member
- Outlook version
- Outlook 2016 32 bit
- Email Account
- Office 365 Exchange
Using the following code (in bold) to categorize an email which triggers an action. I currently have the email moving to a subfolder and this works fine. But now, instead of moving it to that subfolder, I need to copy it to a different folder. Can someone help me change this code so it works. I tried just changing the word "Move" to "Copy" but that didn't do it. Thanks
End SubPrivate Sub objInboxItemsOrder_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, "Karen") > 0 Then
Set objTargetFolder = Application.Session.Folders("orders@xxxxxx.com").Folders("Karen")
objMail.Move objTargetFolder
ElseIf InStr(objMail.Categories, "Purchase Order") > 0 Then
Set objTargetFolder = Application.Session.Folders("orders@xxxxxx.com").Folders("Purchase Order")
objMail.Move objTargetFolder
ElseIf InStr(objMail.Categories, "Quote") > 0 Then
Set objTargetFolder = Application.Session.Folders("orders@xxxxxxx.com").Folders("Quote")
objMail.Move objTargetFolder
End If
End If