View.Filter property (Outlook)
Returns or sets a String value that represents the filter for a view. Read/write.
expression A variable that represents a View object.
The value of this property is a string, in DAV Searching and Locating (DASL) syntax, that represents the current filter for the view. For more information about using DASL syntax to filter items in a view, see Filtering Items.
The following Visual Basic for Applications (VBA) example obtains a View object by using the CurrentView property of the Explorer object, then sets the Filter property of the View object to display only those Outlook items that were received last week.
Private Sub FilterViewToLastWeek() Dim objView As View ' Obtain a View object reference to the current view. Set objView = Application.ActiveExplorer.CurrentView ' Set a DASL filter string, using a DASL macro, to show ' only those items that were received last week. objView.Filter = "%lastweek(""urn:schemas:httpmail:datereceived"")%" ' Save and apply the view. objView.Save objView.Apply End Sub
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.