【问题标题】:Excel VBA @SQL String filter Multiple LIKE ConditionExcel VBA @SQL 字符串过滤器多个 LIKE 条件
【发布时间】:2017-03-14 03:42:53
【问题描述】:

此代码按预期工作,但我还需要在主题行中排除 Autoreplies 和其他一些字符串。我需要知道是否可以再添加 2 或 3 个赞。

我尝试了 And 和 Or 条件,但出现解析错误。

以下代码有效。我只需要在无法投递后添加另一个字符串条件。 " Like '%Automatic reply%'".

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

谢谢。

【问题讨论】:

    标签: excel vba outlook outlook-filter


    【解决方案1】:

    OR应该可以,下面的例子有%undeliverable%%Automatic reply%


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

    添加一个过滤器

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

    【讨论】:

    • 好吧,我不在办公室了。那么我可以添加另一个 Or 来制作 3 个过滤器吗?
    • @wh3resmycar2 是的-玩它-你明白了:-)
    • 好的,我一回到办公室就试试。注意语法中的一些括号..一旦我测试它,我会回击。谢谢老兄。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-04-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-16
    相关资源
    最近更新 更多