Hi Everyone,

i am really new into VBA so I am sorry in advance if my questions are dumb

I am trying to write script to have a macro button. The goal is that I want to select a bunch of email, click on the macro button to run the script and have these email assigned to a category (in the same Inbox folder) based on initials found in the subject.

Here is my first attempt:

Public Sub autocategories()

If InStr(Email.Subject, "[CAT1]",vbTextCompare) > 0 Then
Email.Categories = CAT1
Email.Save
ElseIf InStr(Email.Subject, "[CAT2]",vbTextCompare) > 0 Then
Email.Categories = CAT2
Email.Save
ElseIf InStr(1, Email.Subject, "[CAT3]", vbTextCompare) > 0 Then
Email.Categories = CAT3
End If

End Sub


However, when i click on the macro button, Nothing happens...
Can you please check this and let me know what I am doing wrong? Or is there any other way to have this function added?
We used to work with Oulook rules, but we have so many that our Exchange server cannot handle them all...

Many thanks in advance!