Excel VBA @SQL String filter Multiple LIKE Condition

*爱你&永不变心* 提交于 2019-12-29 01:49:10

问题


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.


回答1:


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%')"


来源:https://stackoverflow.com/questions/42777395/excel-vba-sql-string-filter-multiple-like-condition

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!