Share via


Document.IsDataSourceConnected Property

Publisher Developer Reference

True if the specified publication is connected to a data source. Read-only.

Syntax

expression.IsDataSourceConnected

expression   A variable that represents an Document object.

Remarks

A publication must be connected to a valid data source to perform a mail merge or catalog merge.

Example

The following example tests whether the publication is connected to a data source and, if it is not, specifies and connects a data source to the publication.

Before running this example, you must replace PathToFile with a valid file path and TableName with a valid data source table name.

Visual Basic for Applications
  Dim strDataSource As String
Dim strDataSourceTable As String
'Specify data source and table name

strDataSource = "<em>PathToFile</em>"
strDataSourceTable = "<em>TableName</em>"

'Connect to a datasource
If Not (ThisDocument.<strong>IsDataSourceConnected</strong>) Then
    ThisDocument.MailMerge.OpenDataSource strDataSource, , strDataSourceTable

End If</code>

See Also