473,223 Members | 1,756 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,223 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 3334
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Steve M | last post by:
I'm trying to do invoke the mail merge functionality of MS Word from a Python script. The situation is that I have a template Word document, and a record that I've generated in Python, and I want...
3
by: svdh2 | last post by:
I have been looking at a problem the entire week in access, I have still not been able to find a solution. Hope that you could maybe tell where to look Concerns the link between Access and Word....
4
by: Dadio | last post by:
Hello On my Access database form I have a command button which opens a Word mail merge document in which I have created a number of fields (Title, FirstName, LastName, Address1 etc.) I would...
8
by: Darryl Kerkeslager | last post by:
I hope that although this is 25% Access and 75% Word, that someone will know ... The whole problem here arises because 1) Microsoft acknowledges an 'issue' wherein TextInput type FormFields are...
3
by: Andy Davis | last post by:
I have set up a mail merge document in Word 2003 which gets its data from my Access 2000 database. I want to set up a button on a form that: 1. runs the query to provide the dat for the merge...
4
by: Ray Todd Jr | last post by:
I can't get ths code to correctly execute. After I have clicked on a Access Form, I want the code to open the word document, merge the data, print the forms and then close the two windows that...
1
by: Kaytrim | last post by:
I have an application that puts data into an Excel spreadsheet. It then opens a Word doc that reads the data and either prints the resulting form letters or keeps the file open for viewing. This...
2
by: jojopangit | last post by:
hi, i have the following command and generated an error : "word was unable to open the data source" any help will be greatly appreciated. Thanks in advance. Jude Private Sub...
1
by: kayberrie | last post by:
I want to write a VBA mail merge code. I want to link the code/macro/dohicky to a nifty little button so it makes life easy. I think I can handle the button part, the code part - not so much. I know...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.