VB field update instead of Mail Merge update?

D

Dean Slindee

My starting document has 5 embedded <<xxxxxx>> fields that I am updating by
calling the Mail Merge process in VB. However, the mail merge process
creates a new Mail Merged document (which I no longer have a handle to, and
cannot save from inside VB, or so it appears to me). I am wondering if
there are Word functions that I can call in VB against the original Word
document to update the <<xxxxxx>> fields, instead of using Mail Merge. Or,
is there a way to merge to the original document, and not call Mail Merge?

I am terming these <<xxxxxx>> as fields; please correct my terminology as
appropriate.

New to Word Automation. If there are any books or resources that a newbie
can read, please point me.

Thanks in advance,
Dean Slindee
 
C

Cindy M.

Hi Dean,
My starting document has 5 embedded <<xxxxxx>> fields that I am updating by
calling the Mail Merge process in VB. However, the mail merge process
creates a new Mail Merged document (which I no longer have a handle to, and
cannot save from inside VB, or so it appears to me). I am wondering if
there are Word functions that I can call in VB against the original Word
document to update the <<xxxxxx>> fields, instead of using Mail Merge. Or,
is there a way to merge to the original document, and not call Mail Merge?

I am terming these <<xxxxxx>> as fields; please correct my terminology as
appropriate.

New to Word Automation. If there are any books or resources that a newbie
can read, please point me.
It's a matter of personal opinion, but I feel if merge fields are being used,
so should mail merge. There are (lots of) people who write their data directly
into merge fields...

When you execute the mail merge you can pick up the new document. Usually,
it's become the ActiveDocument, and you can check whether it is a mail merge
result by looking at the document Name, among other things.

Another possibility, assuming this is Word 2003 or 2007, would be to hook into
the MailMergeAfterMerge event. That event returns a Document object as a
parameter of the event to the new document.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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