Excel VBA @SQL String Filter Multiple LIKE Conditions

This code works as intended, but I also need to exclude Autorepliessome other lines in the subject line. I need to know if 2 or 3 more Likes can be added.

I tried the conditions of And and Or, but I got a parsing error.

This code below works. I just need to add another row condition after it has been canceled." Like '%Automatic reply%'".

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

thank.

+2
source share
1 answer

ORShould work. The following example is either %undeliverable%Or%Automatic reply%


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

Add another 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%')"
+2
source

Source: https://habr.com/ru/post/1692258/


All Articles