Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel VBA @SQL String filter Multiple LIKE Condition

This code works as intended but I also need to exclude Autoreplies and some other strings in a subject line. I need to know if it's possible to add 2 or 3 more Likes.

I tried And and Or conditions but I'm getting a parse error.

This code below works. I just need to add another string condition after undeliverable. " Like '%Automatic reply%'".

Filter = "@SQL=" & " Not " & _
             "urn:schemas:httpmail:subject" & "" & _
             " Like '%undeliverable%'"

thanks.

like image 357
wh3resmycar2 Avatar asked Sep 23 '26 08:09

wh3resmycar2


1 Answers

OR Should work, The following Example have either %undeliverable% Or %Automatic reply%


Filter = "@SQL=" & " Not (urn:schemas:httpmail:subject" & _
                   " Like '%undeliverable%'  Or " & _
                         "urn:schemas:httpmail:subject" & _
                   " Like '%Automatic reply%')"

To Add one more Filter

Filter = "@SQL=" & " Not (urn:schemas:httpmail:subject" & _
                   " Like '%undeliverable%'  Or " & _
                         "urn:schemas:httpmail:subject" & _
                   " Like '%Automatic reply%' Or " & _
                         "urn:schemas:httpmail:subject" & _
                   " Like '%Bla Bla%')"
like image 197
0m3r Avatar answered Sep 26 '26 02:09

0m3r



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!