Word Automation

J

Johnny Emde Jensen

Hello

I have made a template with some vba code and mergefields.

From an external application i use this template to generate some mail merge
documents.
Like this:

Dim objApp as Word.Application
Set objApp as new Word.Application

Dim objTemplate as Object
Set objTemplate = objApp.Documents.Open(Filename:="name of file")
objTemplate.MailMerge.OpenDatasource Name:="name of file"
With objTemplate.MailMerge
.Destination = wdSendToNewDocument
.Execute
End With
ect ect

With the .Destination = wdSendToNewDocument I don't get the VBA code sendt
together with the mailmerge information to the new document - is i at all
possible???

Kind regards
Johnny E Jensen
 
D

Doug Robbins - Word MVP

And neither you should. Why would you want the code to perform the
mailmerge in the document created by executing the merge?

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