mailmerge

N

Nathan Franklin

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
 
D

Doug Robbins - Word MVP

You cannot do that. I can' imagine why you would want to. You will have to
execute the merge to a new document.

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

Nathan Franklin

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

Doug Robbins - Word MVP

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.

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top