MailMergeDataSource.SetAllErrorFlags method (Publisher)

Marks all records in a mail merge data source as containing invalid data in an address field.

Syntax

expression.SetAllErrorFlags (Invalid, InvalidComment)

expression A variable that represents a MailMergeDataSource object.

Parameters

Name Required/Optional Data type Description
Invalid Required Boolean True marks all records in the data source of a mail merge as invalid.
InvalidComment Optional String Text describing the invalid setting.

Remarks

You can individually mark records in a data source that contain invalid data in an address field by using the InvalidAddress and InvalidComments properties.

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

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.