ConnectString Property Example

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.

Set myDoc = Documents.Add
With myDoc.MailMerge
    .MainDocumentType = wdFormLetters
    .OpenDataSource _
        Name:="C:\MSOffice\Access\Samples\Northwind.mdb", _
        LinkToSource:=True, AddToRecentFiles:=False, _
        Connection:="TABLE Customers
    MsgBox .DataSource.ConnectString
End With