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 / Programming / February 2006

Tip: Looking for answers? Try searching our database.

mailmerge

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nathan Franklin - 22 Feb 2006 03:00 GMT
Hey Guys..

I am trying to complete an automated mail merge.. It goes through
successfully, but because I have the mail merge destination to a new
document, it creates a new document for the output of the mail merge. If
possible i need the output to stay on the current document... I have tried
ommiting the Destination property and it still launches a new document. Even
if I cant get it to stay on the current document... how do i reference the
new document??

When I first create a document, I create a new document from a tremplate
Doc = App.Documents.Add(Application.StartupPath() & "\template.dot",
Visible:=True)

This loads a new document into the doc variable formated to my template. So
I would like the mailmerge to store into the document that is in the doc
variable.....

A copy of my code is below...
MailMerge = Doc.MailMerge

MailMerge.OpenDataSource(Name:=Application.StartupPath() &
"\temp\merge.doc", LinkToSource:=True, AddToRecentFiles:=False)

MailMerge.Destination = Word.WdMailMergeDestination.wdSendToNewDocument

MailMerge.Execute(False)

Thanks very much

Nathan
Doug Robbins - Word MVP - 22 Feb 2006 20:41 GMT
You cannot do that.  I can' imagine why you would want to.  You will have to
execute the merge to a new document.

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

> Hey Guys..
>
[quoted text clipped - 27 lines]
>
> Nathan
Nathan Franklin - 22 Feb 2006 21:03 GMT
would i just close the current document then after the merge and reference
the new document as App.ActiveDocument. there is only 1 merge document....

> You cannot do that.  I can' imagine why you would want to.  You will have
> to execute the merge to a new document.
[quoted text clipped - 30 lines]
>>
>> Nathan
Doug Robbins - Word MVP - 23 Feb 2006 05:22 GMT
Assuming that you have declared Doc as in

Dim Doc as Document

Then after executing the merge, if you use:

Doc.Close wdDoNotSaveChanges

that will close the mailmerge main document and leave you with the document
created as a result of executing the merge to a new document.

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

> would i just close the current document then after the merge and reference
> the new document as App.ActiveDocument. there is only 1 merge document....
[quoted text clipped - 33 lines]
>>>
>>> Nathan
 
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.