By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,660 Members | 1,309 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,660 IT Pros & Developers. It's quick & easy.

Problem with Microsoft Word Mailmerge in VB.NET Program

P: 1
Hope someone can shed some light on a tricky error.

I am trying to automate a mailmerge in VB.NET using Word 2003. The main document is a previously existing Word file. The data source is a text file created by a separate Oracle SQL program. The main document is linked to the data source; if you open the main doc manually, you get the SQL security message for the name of the text file.

When the program runs the OpenDataSource command for the text file, the “file is locked for editing” dialog box pops up to request the desired course of action. Once the user makes a choice, the merge completes. Unfortunately, this prevents the merge from running automatically.

One comment in a Web post says that when a main document is opened through Automation, the data source is not attached to it. However, it looks like the command to open the main document causes the data source document to be locked as if it had been opened. A check of Task Manager does not show the data source open as a separate process.

It would be greatly appreciated if someone can tell me how to work around this problem or supply an example of mailmerge code using a text file as the data source. Thanks.
Sep 3 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.