Trap Errors in VB.NET Mail Merge Code

K

Kevin G.

I have a VB.NET Service Program that performs a Mail Merge
with template documents and the merge data. When a merge
field is present in the Template Document but not present
in the header fields I receive the "Invalid Merge Field"
Error (Dialog Box). How can I trap this error in code
using the World Mail Merge Object Model?
 
K

Kevin McBride

To be honest, I don't know for sure that you can't dismiss the message with
the ole server, however, I found the a post in MSDN, PSS 307292, which
references using a timer to detect when Word has stopped responding.

It's not the most graceful way to handle it, but it also takes care of other
error messages and problems that may occur while working with Word.

HTH
 
P

Peter Jamieson

Generally speaking the most you can do to prevent alerts is set

Application.DisplayAlerts = wdAlertsNone

but it may not help in the specific case being discussed. AFAIK this sort of
behaviour has long been a problem with Word whatever development environment
you are using and your suggestion is probably the only approach likely to
work.
 

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