Invalid Merge Field

W

workholicme

Hi,

I am having a problem with Word mail merge, when called by Word
Automation. On occassion, the data will be missing a field, and Word
throws up an "Invalid Merge Field" message box, which requires manual
intervention to replace or remove the offending field.


I really need to be able to automate this piece too, but have read
many posts on the web saying that this is not possible. Even setting
DisplayAlerts to none does not work. I am using Word 2003, but am
wondering if this issue is resolved in Word 2007, or similar?


Can anybody give me some advice about this?


Many thanks
 
D

Doug Robbins - Word MVP

I would be 99.9999% sure that the issue has not be resolved in Word 2007

You may be able to use code to iterate through the mergefields in the main
document to get the name of each and see if there is a field of that name in
the data source and if not, delete the mergefield from the main document.
However, if the field is not in the data source, then it should not be in
the main document in the first place.

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