Article ID: 279462 - View products that this article applies to.
This article was previously published under Q279462
This article has been archived. It is offered "as is" and will no longer be updated.
When you call the OpenDataSource method while automating Word 2002, the Select Data Source dialog box appears. If Word is not visible, it may appear to have stopped responding.
When you call OpenDataSource, the Select Data Source dialog box typically appears if you have not provided enough information to connect to the data source. By default, Word 2002 attempts to connect to the data source by using the Office DataSource Object (ODSO). ODSO requires the complete path and file name to either a database or an Office DataSource Connection (.odc) file for the Name argument. If you provide the Name argument with an empty string, the Select Data Source dialog box appears.
To avoid the dialog box to select a data source, do one of the following:
(http://support.microsoft.com/kb/285332/EN-US/ )HOWTO: Automate Word 2002 with Visual Basic to Create a Mail Merge
With Word 97 and Word 2000, the following Automation code creates and executes a mail merge against SQL Server data without user intervention.
Note You must change UID <username> and pwd =<strong password> to the correct values before you run this code. Make sure that UID has the appropriate permissions to perform this operation on the database.
With Word 2002, however, the Select Data Source dialog box appears when the OpenDataSource method is called because the Name argument is an empty string. To correct this problem so that the mail merge can execute without user intervention, change the following line in the sample code
For more information, see the following article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/289830/EN-US/ )PRB: Prompt to Select Table with Word 2002 Mail Merge Code for Excel or Access Data Source