Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / February 2008

Tip: Looking for answers? Try searching our database.

Mail Merge from Access, template showing up also

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AJ - 27 Feb 2008 17:56 GMT
I have a document set up as a template for mail merge using data from a table
in access. Everything is working, except when the document opens up for the
user to view, so does the template, so you have 2 different word documents
opening up. Is there a way to avoid this. I am just wanting the user to see
the merged document, not the template. I have included my code
below. I appreciate any time and advise on this...

Dim objWord As Word.Document
Set objWord = GetObject("G:\Users\AJ\Testing.doc", "Word.Document")
     
objWord.MailMerge.OpenDataSource _
     Name:="G:\Users\AJ\welders\weldxp.mdb", _
     LinkToSource:=True, _
     Connection:="TABLE tblTestLabFacility", _
     SQLStatement:="SELECT * FROM [tblTestLabFacility]"
  ' Execute the mail merge.
  objWord.MailMerge.Execute
  ' Make Word visible.
  objWord.Application.Visible = True

Thank You
Doug Robbins - Word MVP - 27 Feb 2008 18:56 GMT
As objWord is the "document" that you refer to as a template, after the

objWord.Application.Visible = True

insert

objWord.Close wdDoNotSaveChanges
Set objWord = Nothing

and that should close that document, leaving the result of the mailmerge
open.

Signature

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

>I have a document set up as a template for mail merge using data from a
>table
[quoted text clipped - 20 lines]
>
> Thank You
AJ - 28 Feb 2008 13:41 GMT
Doug,
Thank you so much. That was right on....It is working perfect now. Thank you
so much for your time I appreciate it very much.
Have a great day,,,I know I will...
Thanks
AJ

> As objWord is the "document" that you refer to as a template, after the
>
[quoted text clipped - 32 lines]
> >
> > Thank You
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.