Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Mail Merge

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 10-10-2017, 10:12 AM
vincenzo345 vincenzo345 is offline Windows 7 64bit Office 2016
Novice
 
Join Date: Aug 2017
Posts: 12
vincenzo345 is on a distinguished road
Default supress mail merge error document

Hello,



Im working on a mail merge vba script to merge documents individually. I get hung up on some documents with errors.

When Word encounters a field error a separate document pops up that says "A Field Calculation error occurred in record x"

Quite honestly, I dont care about the calculation issues. I just need this error document to dissapear. How can I prevent this error document from popping up?

I've tried looking into the mail merge objects but I cant seem to find any way to work with the error document object.

Any help is appreciated.
Reply With Quote
  #2  
Old 10-10-2017, 11:08 AM
vincenzo345 vincenzo345 is offline Windows 7 64bit Office 2016
Novice
 
Join Date: Aug 2017
Posts: 12
vincenzo345 is on a distinguished road
Default Solved

Just solved it.

It all has to do with the
Code:
.execute = False
I had
Code:
ActiveDocument.MailMerge.execute = False
When this is set to false, it prompts word to open a new document and list all of the field calculation errors. If you set this to
Code:
ActiveDocument.MailMerge.execute = True
this has word display the errors in a message box.

I was able to turn off display alerts which turned off the message box.
I put

Code:
 
Application.DisplayAlerts = wdAlertsNone
at the beginning of the VBA Macro and
Code:
Application.DisplayAlerts = wdAlertsAll
at the end
Reply With Quote
  #3  
Old 10-10-2017, 12:03 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,191
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

You really should address the cause of the field calculation errors instead of trying to hide the warning.

Putting:
Application.DisplayAlerts = wdAlertsNone
"at the beginning of the VBA Macro" kills a mailmerge main document's links to its data source, turning it into an ordinary document and there'll be no mailmerge to execute.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
Reply

Tags
error document, mail merge, vba

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail Merge Error mklindquist0815 Mail Merge 1 07-14-2017 08:36 PM
mail merge error in vba texas1014 Word VBA 2 03-08-2017 03:25 PM
vba error when trying to do a mail merge texas1014 Mail Merge 1 03-08-2017 03:23 PM
Mail merge error? SRE Outlook 0 01-11-2010 05:54 PM
Error Message in Mail Merge A Bhavani Mail Merge 0 11-26-2008 12:08 PM


All times are GMT -7. The time now is 01:29 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft