Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
AJ AJ is offline
external usenet poster
 
Posts: 36
Default Mail Merge from Access, template showing up also

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

  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Mail Merge from Access, template showing up also

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.

--
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

"AJ" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
AJ AJ is offline
external usenet poster
 
Posts: 36
Default Mail Merge from Access, template showing up also

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

"Doug Robbins - Word MVP" wrote:

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.

--
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

"AJ" wrote in message
...
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




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
Mail merge data not showing on Mail Recipient List Connie G Mailmerge 6 October 26th 06 04:17 PM
mail merge recipenst list not showing everything in access databa. Zeric Mailmerge 0 March 22nd 06 09:30 PM
word opens access in mail merge. Access is already opened.=twice Sherri Mailmerge 1 February 11th 06 05:59 PM
mail merge an access db into a post card template using 4 postard. dumb bunnie Mailmerge 1 March 11th 05 02:39 AM
mail merge an access db into a post card template using 4 postard. dumbbunniefjc Mailmerge 0 March 11th 05 12:41 AM


All times are GMT +1. The time now is 07:50 AM.

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"