Reply
 
Thread Tools Display Modes
  #1   Report Post  
John Lane
 
Posts: n/a
Default Question on Mail Merge from Access

I have the code snipet below that runs Word Mail Merge from Access. When Word
runs, it first opens the "skeleton" Word document, then specializes it with
the query and opens it a second time with the parameters filled in. When the
user closes the document, Word now displays the skeleton document/form. Is
there a way to either not show/hide the first instance, or when the user
closes the 2nd instance, the 1st instance is closed? Thanks.
Set objWord = GetObject(strFilepath)
objWord.Application.visible = True
objWord.MailMerge.OpenDataSource Name:=CurrentDb.Name, LinkToSource:=True,
SQLStatement:=strSQL
objWord.MailMerge.Execute
  #2   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi ?B?Sm9obiBMYW5l?=,

I'm not 100% certain I understand - unfamiliar terminology, I think. Let me put
the process into Word terminology, and see if we're on the same wavelength:

You code opens the main merge document (the document with the merge fields). You
then connect it to the data source with a specific SQL, so that a specific set
of data will be pulled. Then you execute the mail merge to a new document; the
result document.

And you're concerned about closing the main merge document so that the user need
not do so?

Declare an object variable, and set it to the main merge document. Based on your
current code, something like this:

objWord.Close objWord.Application.wdDoNotSaveChanges

I have the code snipet below that runs Word Mail Merge from Access. When Word
runs, it first opens the "skeleton" Word document, then specializes it with
the query and opens it a second time with the parameters filled in. When the
user closes the document, Word now displays the skeleton document/form. Is
there a way to either not show/hide the first instance, or when the user
closes the 2nd instance, the 1st instance is closed? Thanks.
Set objWord = GetObject(strFilepath)
objWord.Application.visible = True
objWord.MailMerge.OpenDataSource Name:=CurrentDb.Name, LinkToSource:=True,
SQLStatement:=strSQL
objWord.MailMerge.Execute


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Web-Site-based Word Mail Merge & Access DB Alex Maghen Mailmerge 3 January 17th 05 09:52 PM
Access to Word Mail Merge; symbols change to question marks Rob S. Mailmerge 1 January 17th 05 12:25 PM
mail merge and access query DaveAS Mailmerge 6 January 6th 05 06:33 PM
Word 2003 and Access 2003 Mail Merge question HD87glide Microsoft Word Help 2 December 15th 04 02:29 PM
Word mail merge with Access Linda Mailmerge 1 December 7th 04 11:46 PM


All times are GMT +1. The time now is 11:11 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"