Comparison Property [Publisher 2003 VBA Language Reference]
MsoFilterComparison
MsoFilterComparison can be one of these MsoFilterComparison constants. |
msoFilterComparisonContains |
msoFilterComparisonEqual |
msoFilterComparisonGreaterThan |
msoFilterComparisonGreaterThanEqual |
msoFilterComparisonIsBlank |
msoFilterComparisonIsNotBlank |
msoFilterComparisonLessThan |
msoFilterComparisonLessThanEqual |
msoFilterComparisonNotContains |
msoFilterComparisonNotEqual |
expression.Comparison
expression Required. An expression that returns one of the objects in the Applies To list.
Example
The following example changes an existing filter to remove from the mail merge all records that do not have a Region field equal to "WA". This example assumes that a mail merge data source is attached to the active publication.
Sub SetQueryCriterion()
Dim intItem As Integer
With ActiveDocument.MailMerge.DataSource.Filters
For intItem = 1 To .Count
With .Item(intItem)
If .Column = "Region" Then
.Comparison = msoFilterComparisonNotEqual
.CompareTo = "WA"
If .Conjunction = "Or" Then .Conjunction = "And"
End If
End With
Next intItem
End With
End Sub
Applies to | MailMergeFilterCriterion Object