471,594 Members | 2,060 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,594 software developers and data experts.

Opening a Word mailmerge Main Document (form letter)

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
2 3197
BTW, it is not a VSTO project, just a normal Windows Form VB project.

Colin Halliday
Jun 21 '06 #2
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.

Similar topics

2 posts views Thread by Steve M | last post: by
4 posts views Thread by Dadio | last post: by
8 posts views Thread by Darryl Kerkeslager | last post: by
1 post views Thread by Kaytrim | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.