(Solved) – VBA Like Operator


I want to monitor our public e-mail folder for specific new mails to arrive and then use MsgBox to create a pop-up Window. Everything is set up and works prett well apart from the matching part using the Like Operator.

I want to match the following string in the subject of the E-Mail:


which I manage to do by using:

Like "*XXX*YYY*"

What I am struggeling with is when someone replies to that E-Mail and the subject changes to:

Re:*XXX*YYY* or Aw:*XXX*YYY*

If that is the case, I do not want to create a pop-up message since it is an answer to the original E-Mail.

I tried stuff like:

If subject Like "*[!aw:]*" & "*[!re:]*" Then
   If subject Like "*XXX*YYY*" Then

in various combinations but I do not seem to get it working properly.

Can anyone assist?

Leave a Reply

Your email address will not be published. Required fields are marked *