Filtering Items Using an Integer Comparison

You can compare an integer property with an integer value in a filter string using Microsoft Jet syntax or DAV Searching and Locating (DASL) syntax. You can specify the integer value with or without quotation marks as delimiters. The following three filter strings filter on the condition that the Importance value is high:

criteria = "[Importance] = 2"

If you want to use a value from an integer enumeration, convert the value to a string and append it to the filter string. The following filters are equivalent and test for items with importance set to high:

criteria = "[Importance] = " _ & CStr(Outlook.OlImportance.olImportanceHigh)

criteria = "@SQL=" & Chr(34) & "urn:schemas:httpmail:importance" _ & Chr(34) & " = 2"

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.