ConnectString Property

Microsoft Word Visual Basic

ConnectString Property

       

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

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.

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