MailMergeFields.AddSkipIf (Word)

Adds a SKIPIF field to a mail merge main document. Returns a MailMergeField object.

A SKIPIF field compares two expressions, and if the comparison is true, SKIPIF moves to the next record in the data source and starts a new merge document.

AddSkipIf (Range, MergeField, Comparison, CompareTo)


Documents("Main.doc").MailMerge.Fields(1).Select 
Selection.Collapse Direction:=wdCollapseStart 
Documents("Main.doc").MailMerge.Fields.AddSkipIf _ 
 Range:=Selection.Range, MergeField:="PostalCode", _ 
 Comparison:=wdMergeIfEqual, CompareTo:="98040"

Arguments

The following arguments are required:

Range (Range) - The location for the SKIPIF field.

MergeField (String) - The merge field name.

Comparison (WdMailMergeComparison) - The operator used in the comparison.


Possible values are

wdMergeIfEqual A value is output if the mail merge field is equal to a value.
wdMergeIfGreaterThan A value is output if the mail merge field is greater than a value.
wdMergeIfGreaterThanOrEqual A value is output if the mail merge field is greater than or equal to a value.
wdMergeIfIsBlank A value is output if the mail merge field is blank.
wdMergeIfIsNotBlank A value is output if the mail merge field is not blank.
wdMergeIfLessThan A value is output if the mail merge field is less than a value.
wdMergeIfLessThanOrEqual A value is output if the mail merge field is less than or equal to a value.
wdMergeIfNotEqual A value is output if the mail merge field is not equal to a value.

Optional arguments

The following argument is optional

CompareTo (String) - The text to compare with the contents of MergeField.