Mail merge switches
Mail merge switches are special commands that can be used in a mail merge document to control the behavior of the merge process. Here are some common mail merge switches:
Switches for controlling the merge process
MERGEFORMAT
: This switch tells Word to merge the data into the document using the current formatting.NOCONVERT
: This switch tells Word not to convert the data to the document's character set.NOFMT
: This switch tells Word not to format the data.NOGAP
: This switch tells Word not to insert a space between the merged data and the surrounding text.NOKEEP
: This switch tells Word not to keep the original data in the document.
Switches for controlling the output
OUTPUT
: This switch specifies the output file name and location.OUTPUTDIR
: This switch specifies the output directory.OUTPUTFILE
: This switch specifies the output file name.OUTPUTFORMAT
: This switch specifies the output file format (e.g. PDF, DOCX, etc.).
Switches for controlling the data source
DATASOURCE
: This switch specifies the data source file name and location.DATASOURCEFORMAT
: This switch specifies the format of the data source file (e.g. CSV, XML, etc.).DATASOURCENAME
: This switch specifies the name of the data source.
Switches for controlling the merge fields
MERGEFIELD
: This switch specifies the merge field to use in the document.MERGEFIELDNAME
: This switch specifies the name of the merge field.MERGEFIELDTYPE
: This switch specifies the type of the merge field (e.g. text, date, etc.).
Switches for controlling the merge options
MERGEOPTIONS
: This switch specifies the merge options (e.g. whether to merge in the background, etc.).MERGEOPTION
: This switch specifies a specific merge option (e.g. whether to merge in the background, etc.).
Here are some examples of how to use mail merge switches:
- To merge a document using the current formatting, use the
MERGEFORMAT
switch:MERGEFORMAT
- To specify the output file name and location, use the
OUTPUT
switch:OUTPUT C:\Output\Document.docx
- To specify the data source file name and location, use the
DATASOURCE
switch:DATASOURCE C:\Data\DataSource.csv
- To specify the merge field to use in the document, use the
MERGEFIELD
switch:MERGEFIELD FirstName
Note that the exact syntax and available switches may vary depending on the version of Word and the operating system you are using.