Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
[email protected] karen_greenwood@oma.org is offline
external usenet poster
 
Posts: 1
Default Suppress error messages when merging in batch

We do merge in Word through a batch job. This is fine unless there is
an error, for example one of the records in the data file is
incomplete. Then the merge hangs. If such a merge were run online
the user would see the error message and acknowledge it, but in batch
mode there is no way to acknowledge it. Is there any way to avoid the
hanging and instead have Word exit and return an error code to the
calling program?

  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Suppress error messages when merging in batch

As far as I know because I don't do bulk stuff like this,
a. you cannot trap all errors using the Word object model. For example, you
cannot trap the "error" where the Mail Merge Data Source does not exist.
b. You probably already know that you can reduce the possible number of
dialog messages by setting

objWordApplication.DisplayAlerts = wdAlertsNone

(where objWordApplication is your Word Applicaiton object

c. You can suppress some types of error by executing the merge using

objWordApplication.objMMMD.MailMerge.Execute Pause:=False

(rather than objWordApplication.objMMMD.MailMerge.Execute Pause:=True)

where objMMMD is your Mail Merge Main Document object

If you do that, some syntax errors will be logged in a separate Errors
document. But how do you know that such a document has been created? Well,
you can compare the document count and document names pre- and post- merge.
For example, if pre-merge your document count is always 1, then
1. if you are merging to a new document and there are no errors, post-merge
you should see 2 documents (MMMD, destination document), and the
ActiveDocument should be the Destination Document
2. if you are merging to a new document and there are errors, post-merge
you should see 3 documents (MMMD, destination document, error document), the
ActiveDocument should be the error document, and the ActiveDocument.Name
should be something like "Mail Merge ErrorsNNN" where NNN is a sequence
number (at least, in Word 2003, English Language version it's like that).
3. if you are merging to any other destination type and there are no
errors, post-merge you should see 1 document (MMMD), and the ActiveDocument
should be the MMMD
4. if you are merging to a any other destination type and there are errors,
post-merge you should see 2 documents (MMMD, error document), the
ActiveDocument should be the error document, and the ActiveDocument.Name
should be as above.

I know that some simple errors, e.g. you have a formula field { ={
MERGEFIELD myfield } } and myfield is not numeric) will be dealt with by
setting .DisplayAlerts = wdAlertsNone anyway (in other words, if those are
the only types of error you get, you don't need to contemplate produing an
Error Document, but if you do, an Error Document will be produced when this
error occurs, regardless of the state of .DisplayAlerts). However, I don't
have enough experience of doing that to tell you exactly what types of error
are trapped by what technique.

Peter Jamieson

wrote in message
oups.com...
We do merge in Word through a batch job. This is fine unless there is
an error, for example one of the records in the data file is
incomplete. Then the merge hangs. If such a merge were run online
the user would see the error message and acknowledge it, but in batch
mode there is no way to acknowledge it. Is there any way to avoid the
hanging and instead have Word exit and return an error code to the
calling program?


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
error messages DickWho Microsoft Word Help 3 October 6th 08 12:18 PM
Error Messages Dolly Microsoft Word Help 4 January 30th 07 11:32 PM
Word 2003 - when closing receive 'Runtime Error 91' error messages RLC Web Microsoft Word Help 1 January 11th 06 06:16 AM
Error Messages Suzanne Kirchner Microsoft Word Help 1 April 27th 05 09:51 PM
error messages. hudkeekd Microsoft Word Help 1 March 27th 05 04:32 PM


All times are GMT +1. The time now is 12:28 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"