MailMergeDataSource.ConnectString property (Word)

Returns the connection string for the specified mail merge data source. Read-only String.


expression. ConnectString

expression A variable that represents a 'MailMergeDataSource' object.


This example creates a new main document and attaches the Customers table from a Microsoft Access database named "Northwind.mdb." The connection string is displayed in a message box.

Dim docNew As Document 
Set docNew = Documents.Add 
With docNew.MailMerge 
 .MainDocumentType = wdFormLetters 
 .OpenDataSource _ 
 Name:="C:\Program Files\Microsoft Office\Office" & _ 
 "\Samples\Northwind.mdb", _ 
 LinkToSource:=True, AddToRecentFiles:=False, _ 
 Connection:="TABLE Customers" 
 MsgBox .DataSource.ConnectString 
End With

See also

MailMergeDataSource Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.