Microsoft Word Suite
294
Command: make new data merge next if field
Adds a NEXTIF field to a mail merge main document. Returns a data merge field 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
make new data merge next if field data merge Required. An expression that returns a data
merge object.
text range text range Required text range object. The location for the NEXTIF field.
merge field Unicode text Required. The merge field name.
comparison enumeration Required. The operator used in the comparison. Can be one of the
following: merge if equal, merge if greater than, merge if greater than or equal, merge if is
blank, merge if is not blank, merge if less than, merge if less than or equal, or merge if not
equal.
[compare to Unicode text] Optional. The text to compare with the contents of merge field.
Example
This example adds a NEXTIF field before the first MERGEFIELD field in Main.doc. If the next postal
code equals 98004, the next data record is merged into the current merge document.
select data merge field 1 of data merge of document "Main.doc"
collapse range text object of selection direction collapse start
make new data merge next if field data merge of document "Main.doc" ¬
text range text object of selection merge field "PostalCode" ¬
comparison merge if equal compare to "98004"
Command: make new data merge rec field
Adds a MERGEREC field to a mail merge main document. Returns a data merge object. A
MERGEREC field inserts the number of the current data record (the position of the data record in
the current query result) during a mail merge.
Syntax
make new data merge rec field data merge Required. An expression that returns a data merge
object.
text range text range Required text range object. The location for the MERGEREC field.
Example
This example inserts text and a MERGEREC field at the beginning of the active document.
set myRange to create range active document start 0 end 0
make new data merge rec field data merge of active document text range myRange
insert text "Record Number: " at myRange