Currently using the following script to round robin assign incoming emails:
Script works great! (thanks Diane)
What I want to add to it is add an IF condition where the script scans all incoming emails, and if it finds an incoming email with a subject that EXACTLY matches an email that has already been categorized to Bob, Larry, Buddy or Sue, categorize that new email to them as well. (i.e. if Bob has an email categorized to him with subject "Test 1234", then if a new emails comes in with subject "Test 1234", I would like that new email categorized to him and not be assigned "round robin".
Not to make it more complicated, but I also do want want that new email with the duplicate subject to count towards the "round robin". (i.e. email 1 goes to Bob, emails 2 comes in with a duplicate subject and goes to Larry who has an email with the same subject, if email 3 comes in without a duplicate subject, I want that to go to Larry as well since he is next in line for new emails after Bob)
Thanks for any help!
Dim i As Long
Private WithEvents olInboxItems As Items
Private Sub Application_Startup()
Dim objNS As NameSpace
Set objNS = Application.Session
Set olInboxItems = GetFolderPath("Mailbox - SATPD\Inbox").Items
Set objNS = Nothing
End Sub
Private Sub olInboxItems_ItemAdd(ByVal Item As Object)
Dim strCat As String
On Error Resume Next
If Item.Class = olMail Then
Select Case i
Case 0
strCat = "Bob"
Case 1
strCat = "Larry"
Case 2
strCat = "Buddy"
Case 3
strCat = "Sue"
End Select
Item.Categories = strCat
Item.UnRead = True
Item.Save
Err.Clear
End If
i = i + 1
Debug.Print i
If i = 4 Then i = 0
End If
End Sub
Script works great! (thanks Diane)
What I want to add to it is add an IF condition where the script scans all incoming emails, and if it finds an incoming email with a subject that EXACTLY matches an email that has already been categorized to Bob, Larry, Buddy or Sue, categorize that new email to them as well. (i.e. if Bob has an email categorized to him with subject "Test 1234", then if a new emails comes in with subject "Test 1234", I would like that new email categorized to him and not be assigned "round robin".
Not to make it more complicated, but I also do want want that new email with the duplicate subject to count towards the "round robin". (i.e. email 1 goes to Bob, emails 2 comes in with a duplicate subject and goes to Larry who has an email with the same subject, if email 3 comes in without a duplicate subject, I want that to go to Larry as well since he is next in line for new emails after Bob)
Thanks for any help!