ApplyFilter Method

Microsoft Publisher Visual Basic

expression.ApplyFilter

expression    Required. An expression that returns one of the objects in the Applies To list.

Example

This example adds a new filter that removes all records with a blank Region field and then applies the filter to the active publication. This example assumes that a mail merge data source is attached to the active publication.

Sub FilterDataSource()
    With ActiveDocument.MailMerge.DataSource
        .Filters.Add Column:="Region", _
            Comparison:=msoFilterComparisonIsBlank, _
            Conjunction:=msoFilterConjunctionAnd
        .ApplyFilter
    End With
End Sub