我想使用 DASL 過濾器來過濾在特定日期收到的郵件。
filterstring = "@SQL=""urn:schemas:httpmail:subject"" LIKE '%" & subject & "%'" & _
" AND ""urn:schemas:httpmail:datereceived"" LIKE '%" & received_date & "%'" & _
" AND ""urn:schemas:httpmail:datereceived"" LIKE '%" & received_date_plus & "%'"
變數是先前定義的。“received_date_plus”是接收日期加上一天。
uj5u.com熱心網友回復:
LIKE
運算子用于字串屬性。您需要使用<
和>
比較日期時間值(并且永遠不要使用相等運算子)。在使用日期時間比較過濾專案一文中閱讀更多相關資訊。
filterstring = "@SQL=""urn:schemas:httpmail:subject"" LIKE '%" & subject & "%'" & _
" AND ""urn:schemas:httpmail:datereceived"" > '" & Format(received_date ,"General Date")& "' & _
" AND ""urn:schemas:httpmail:datereceived"" < '" & Format(received_date_plus, "General Date") & "'"
請注意日期的格式應像 Outlook 所期望的那樣。Format
因此,使用VBA 中可用的功能是有意義的。
此外,您可能會發現以下文章很有幫助:
- 如何:使用 Find 和 FindNext 方法檢索 Outlook 日歷專案
- 如何:在 Outlook 中使用 Restrict 方法獲取日歷專案
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/485932.html
上一篇:事件變化-什么是“記錄模式”?