AddNextIf Method

See Also         Example         Applies To

Adds a NEXTIF field to a mail merge main document. Returns a MailMergeField object. A NEXTIF field compares two expressions, and if the comparison is true, the next data record is merged into the current merge document.

Syntax

expression.AddNextIf(Range, MergeField, Comparison, CompareTo)

expression   Required. An expression that returns a MailMergeFields object.

Range   Required Range object. The location for the NEXTIF field.

MergeField   Required String. The merge field name.

Comparison   Required Long. The operator used in the comparison. Can be one of the following WdMailMergeComparison constants: wdMergeIfEqual, wdMergeIfGreaterThan, wdMergeIfGreaterThanOrEqual, wdMergeIfIsBlank, wdMergeIfIsNotBlank, wdMergeIfLessThan, wdMergeIfLessThanOrEqual, or wdMergeIfNotEqual.

CompareTo   Required String. The text to compare with the contents of MergeField.