MailMerge.EditDataSource method (Word)

Opens or switches to the mail merge data source.

Syntax

expression. EditDataSource

expression Required. A variable that represents a 'MailMerge' object.

Remarks

If the data source is a Microsoft Word document, this method opens the data source (or activates the data source if it is already open).

If Word is accessing the data through dynamic data exchange (DDE)—using an application such as Microsoft Office Excel or Microsoft Office Access—this method displays the data source in that application.

If Word is accessing the data through open database connectivity (ODBC), this method displays the data in a Word document. Note that, if Microsoft Query is installed, a message appears providing the option to display Microsoft Query instead of converting data.

Example

This example opens or activates the data source attached to the document named "Sales.doc."

Documents("Sales.doc").MailMerge.EditDataSource

This example opens or activates the attached data source if the data source is a Word document.

Dim dsMain As MailMergeDataSource 
 
Set dsMain = ActiveDocument.MailMerge.DataSource 
If dsMain.Type = wdMergeInfoFromWord Then 
 ActiveDocument.MailMerge.EditDataSource 
End If

See also

MailMerge 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.