Table of contents
Collapse the table of content
Expand the table of content

Document.IsDataSourceConnected Property (Publisher)

office 365 dev account|Last Updated: 8/24/2017
3 Contributors

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


expression. IsDataSourceConnected

_expression_A variable that represents an Document object.


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


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.

Dim strDataSource As String 
Dim strDataSourceTable As String 

 'Specify data source and table name 

 strDataSource = "PathToFile" 
 strDataSourceTable = "TableName" 

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

 End If
© 2018 Microsoft