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

Opening a Word mailmerge Main Document (form letter)

P: n/a
I have a Word 2003 mail merge main document (form letter) that is linked to another Word document data source for the mail merge.

If I open this doc using the Word GUI, it first asks me to confirm that I want to run a query to select the data from the data source file, then it opens the form letter fine. I can preview the merged records and complete a merge to a new document.

I have a VB 2006 project (.net framework 2.0) which opens the same form letter in code like this:

aplWord.Documents.Open(mstrFormLetter)

This does open the form letter and displays it in Word, but it is no longer a mail merge main document. I have to manually link it to the data source before I can merge. Once I close the doc and open it manually in Word it is a main document still and asks me to confirm that I want to select the data from the data source again.

What else do I need to do in my code to open it ready for the mail merge??

Thanks.
--
Colin Halliday
Jun 21 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
BTW, it is not a VSTO project, just a normal Windows Form VB project.

Colin Halliday
Jun 21 '06 #2

P: n/a
Thanks, Doug.

Your reference to the KB Article answered my question.

My Word Application object had DisplayAlerts set to not display any alerts.
This stops Word from prompting about running the select statement on the
data source BUT ALSO STOPS THE DOC FROM BEING OPENED AS A MAILMERGE
DOCUMENT!

I have turned the alerts back on and it works fine.
Colin
"Doug Robbins - Word MVP" <dk*@REMOVECAPSmvps.org> wrote in message
news:uL**************@TK2MSFTNGP03.phx.gbl...
Can't help with the dot net part, but for the SQL issue see the following
Knowledge Base article:

"Opening This Will Run the Following SQL Command" Message When You Open a
Word Document - 825765 at:

http://support.microsoft.com?kbid=825765

Are you sure that the answer No was not given when the SQL message
appeared and the document was then saved. I believe that my convert it to
a normal Word document and hence detach it from the data source.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Colin Halliday" <ko******@newsgroup.nospam> wrote in message
news:uu**************@TK2MSFTNGP04.phx.gbl...
I have a Word 2003 mail merge main document (form letter) that is linked
to another Word document data source for the mail merge.

If I open this doc using the Word GUI, it first asks me to confirm that
I want to run a query to select the data from the data source file, then
it opens the form letter fine. I can preview the merged records and
complete a merge to a new document.

I have a VB 2006 project (.net framework 2.0 - not VSTO) which opens the
same form letter in code like this:

aplWord.Documents.Open(mstrFormLetter)

This does open the form letter and displays it in Word, but it is no
longer a mail merge main document. I have to manually link it to the
data source before I can merge. Once I close the doc and open it
manually in Word it is a main document still and asks me to confirm that
I want to select the data from the data source again.

What else do I need to do in my code to open it ready for the mail
merge??

Thanks.
--
Colin Halliday



"Colin Halliday" <ko******@newsgroup.nospam> wrote in message news:%2****************@TK2MSFTNGP03.phx.gbl...
I have a Word 2003 mail merge main document (form letter) that is linked to another Word document data source for the mail merge.

If I open this doc using the Word GUI, it first asks me to confirm that I want to run a query to select the data from the data source file, then it opens the form letter fine. I can preview the merged records and complete a merge to a new document.

I have a VB 2006 project (.net framework 2.0) which opens the same form letter in code like this:

aplWord.Documents.Open(mstrFormLetter)

This does open the form letter and displays it in Word, but it is no longer a mail merge main document. I have to manually link it to the data source before I can merge. Once I close the doc and open it manually in Word it is a main document still and asks me to confirm that I want to select the data from the data source again.

What else do I need to do in my code to open it ready for the mail merge??

Thanks.
--
Colin Halliday
Jun 22 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.