SetAllIncludedFlags Method

Microsoft Word Visual Basic

SetAllIncludedFlags Method

       

True to include all data source records in a mail merge.

expression.SetAllIncludedFlags(Included)

expression   Required. An expression that returns a MailMergeDataSource object.

Included  Required Boolean. True to include all data source records in a mail merge. False to exclude all data source records from a mail merge.

Remarks

You can set individual records in a data source to be included in or excluded from a mail merge using the Included property.

Example

This example marks all records in the data source as containing an invalid address field, sets a comment as to why it is invalid, and excludes all records from the mail merge.

Sub FlagAllRecords()
    With ActiveDocument.MailMerge.DataSource
        .SetAllErrorFlags Invalid:=True, InvalidComment:= _
            "All records in the data source have only 5-" _
            & "digit zip codes.  Need 5+4 digit zip codes."
        .SetAllIncludedFlags Included:=False
    End With
End Sub