我一直在努力使这个声明成为 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/