How to handle mailmerge errors in VB

B

Bindhu

Hi All,

We have a VB program which opens word documents and data source and
performs mailmerge programmatically.Whenever there is a problem with
mailmerge (eg: some mergefields are missing) the word session hangs.
It pop-ups some dialogs,like "Record and header delimiter" or "invalid
merge field". These dialogs require manual intervention but,
programmatically it is difficult to supress these dialogs, the reason
being there are multiple scenarios or worse still the WORD session
itself is hidden.

Is there a method to handle this programatically and supress these
dialogs?

Any help will be appreciated.

Regards
Bindhu
 
J

JB

Bindhu said:
Hi All,

We have a VB program which opens word documents and data source and
performs mailmerge programmatically.Whenever there is a problem with
mailmerge (eg: some mergefields are missing) the word session hangs.
It pop-ups some dialogs,like "Record and header delimiter" or "invalid
merge field". These dialogs require manual intervention but,
programmatically it is difficult to supress these dialogs, the reason
being there are multiple scenarios or worse still the WORD session
itself is hidden.

Is there a method to handle this programatically and supress these
dialogs?

Any help will be appreciated.

Regards
Bindhu
I assume that you've looked at using Error Handling?

If not you should have a look at the Err object and use something like

On Error Goto ErrHandle

'Create error Here

:ErrHandle

Msgbox Err.number & Err.Description

etc etc

If you know the range of errors your likely to encounter you can use
additional trapping in the error handler itself. I normally use a
seperate module to do my error handling and pass everything I need to
knowe about the error to it including the function name where it all
went wrong. That way if it's a false error (something you can account
for in your error routine) you can simply return to the function or sub
by calling it again.

HTH

J
 

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