Microsoft Word Suite
293
[compare to Unicode text] Optional. The text to compare with the contents of merge field.
[true text Unicode text] Optional. The text thats inserted if the comparison is true.
[false text Unicode text] Optional. The text thats inserted if the comparison is false.
Example
This example inserts "for your personal use" if the Company merge field is blank and "for your
business" if the Company merge field is not blank.
make new data merge if field data merge of active document text range ¬
text object of selection merge field "Company" comparison ¬
merge if is blank true text "for your personal use" false text ¬
"for your business"
This example inserts an IF field that compares the contents of the merge field named "Title" with the
text "Mr." When the merge is performed, "Hello" is inserted if the comparison is true.
set show field codes of view of active window to false
set myRange to create range active document start 0 end 0
make new data merge if field data merge of active document text range ¬
myRange merge field "Title" comparison merge if equal compare to ¬
"Mr." true text "Hello "
Command: make new data merge next field
Adds a NEXT field to a mail merge main document. Returns a data merge field object. A NEXT
field advances to the next data record so that data from more than one record can be merged into
the same merge document (for example, a sheet of mailing labels).
Syntax
make new data merge next field data merge Required. An expression that returns a data merge
object.
text range text range Required text range object. The location for the NEXT field.
Example
This example adds a NEXT field after the third MERGEFIELD field in Main.doc.
select data merge field 3 of data merge of document "Main.doc"
collapse range text object of selection direction collapse end
make new data merge next field data merge of document "Mail.doc" text range ¬
text object of selection