Excel VBA @SQL 字符串过滤器

标签 excel vba outlook outlook-filter

我一直在努力使这个声明成为 NOT 声明:

strfilter = "@SQL=" & Chr(34) & "urn:schemas:httpmail:subject" & Chr(34) & " like '%undeliverable%'"

此 strfilter 正在 items.restrict(strfilter) 中使用,因此显然它正在检查所有包含单词 undeliveable 的电子邮件。

我需要做的是转换此语句,以便排除所有主题包含单词“无法送达”的电子邮件。

我已经试过了,但它返回了一个解析错误:

"strFilter = "@SQL=" & Chr(34) & "urn:schemas:httpmail:subject" & Chr(34) & " NOT '%undeliverable%'"

提前致谢。

最佳答案

正确的语法是

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

或者我更喜欢这个然后喜欢

strFilter = "@SQL=" & " Not " & _
            "urn:schemas:httpmail:subject" & "" & _
            " ci_phrasematch 'undeliverable'"

关于Excel VBA @SQL 字符串过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42696902/

相关文章:

vba - 如何在 Powerpoint 中创建自定义形状菜单

c# - BackgroundWorker Completed 似乎没有在主线程中运行?

excel - 从表中的当前选择中删除重复项

excel - NamedRange 引用另一个命名范围

vba - 如何在自定义下拉功能区控件上设置所选项目

regex - Outlook:如何过滤在正文中明确提到我名字的电子邮件

vba - Outlook 2010 中的 Visual Basic 宏,保存到特定文件夹?

vba - 如果正文包含字符串,则删除签名

vba - 在 VBA 中动态设置行高

c# - GemBox.Spreadsheet 最后使用的行