Log in

View Full Version : Create outlook rule for email with case-sensitive subject



MacroUser
03-12-2015, 10:11 AM
I need to create a rule in outlook using Macro so that emails having subject line as "Test" go to Test1 folder and emails with subject line "TEST" will go to Test2 folder. How do I create rule for this scenario? Any inputs on this are greatly appreciated. Thanks.
Sincerely

MacroUser
03-12-2015, 10:54 AM
Can somebody please help?

gmayor
03-13-2015, 12:45 AM
You can do it with a rule with a script. The following should work



Sub MoveBySubject(olItem As Outlook.MailItem)
Dim strfolder As String
With olItem
Select Case .Subject
Case "Test": strfolder = "Test1"
Case "TEST": strfolder = "Test2"
Case Else: GoTo lbl_Exit
End Select
End With
olItem.Move Session.GetDefaultFolder(olFolderInbox).folders(strfolder)
lbl_Exit:
Exit Sub
End Sub


Please note that this is not a help desk. The users here are volunteers, based all over the world, who respond when they are able. It doesn't require a reminder after only 43 minutes.