MailMergeCreateDataSource

Syntax

MailMergeCreateDataSource .FileName = text [, .PasswordDoc = text] [, .HeaderRecord = text] [, .MSQuery] [, .SQLStatement = text] [, .SQLStatement1 = text] [, .Connection = text] [, .LinkToSource = number]

Remarks

Creates a Word document that stores data for a mail merge. MailMergeCreateDataSource attaches the new data source to the active document, which becomes a main document if it is not one already.

To create a new data source with a table you can fill in later, specify only .FileName and .HeaderRecord (and .PasswordDoc if you want to protect the new data source).

Argument

Explanation

.FileName

The path and filename for the new data source

.PasswordDoc

A password to protect the new data source

.HeaderRecord

Field names for the header record. If omitted, the standard header record is used: "Title, FirstName, LastName, JobTitle, Company, Address1, Address2, City, State, PostalCode, Country, HomePhone, WorkPhone." To separate field names in Windows, use the character specified by the "sList" setting in the [intl] section of your WIN.INI file. (In Windows 95 and Windows NT, this setting is stored in the registry.)

.MSQuery

Launches Microsoft Query, if installed (Windows only). The .FileName, .PasswordDoc, and .HeaderRecord arguments a re ignored.


The .SQLStatement, .SQLStatement1, and .Connection arguments have no effect in MailMergeCreateDataSource instructions. If you display the Create Data Source dialog box using a dialog record and a Dialog or Dialog() instruction, you can return the values of these arguments. For more information about returning these values, see MailMergeDataSource$(). The .LinkToSource argument is ignored.

See Also

MailMergeCreateHeaderSource, MailMergeDataSource$(), MailMergeEditDataSource, MailMergeOpenDataSource