resolved:Suppress Merge Field Calculation Errors in Word 2000
Many thanks for the replies to this post. Prompted me to revisit my field codes where the error was apparently generating, despite the results being accurate anyway.
FYI, the error was generating using an{ IF a=x and b=y } type scenario. Turns out the the 'and' requirement needed to be nested in its own field. Error has ceased and document functions fine.
found this useful: kb189018
Thanks all.
xentaur.
Hi there
The following issue has me perplexed to say the least and any help would be appreciated.
Merging to New document in Word 2000 using Table in Access 2000 as Data Source - document has to be bomb-proof for end-users. Snippet of code being used in main document as follows:
VB Code:
Application.DisplayAlerts = wdAlertsNone
ActiveDocument.MailMerge.Destination = wdSendToNewDocument
ActiveDocument.MailMerge.Execute
ThisDocument.Saved = True
CommandBars("Menu Bar").Enabled = True
CommandBars("standard").Visible = True
CommandBars("Formatting").Visible = True
Application.CommandBars("Menu Bar").Controls("&File").Controls("Save &as...").Enabled = True
ThisDocument.Close
As you can see, document merges to new document (good ol' FormLetters) and closes itself, returning standard menubars to documents (previously removed to prevent alteration to main document - just accept that it has to be that way!)
Problem is this:
The form letters are throwing merging errors at me. I've determined that the error lies in a table which calculates dates. However, the only error that is apparent is the generation of the errors - the form letters print just fine - no errors in the date calculations or anywhere else for that matter.
I'm quite happy to release this to users except that the merging to FormLetters is also generating the Mail Merge Errors document.
How can I suppress the generation of this error document, or indeed switch off error-checking during the merge so that the Mail Merge Error document is not generated, leaving my end-user with only the FormLetters on their desktops?
Any help much appreciated - I'm balding as we speak...
Cheers
xentaur
Re: Suppress Merge Field Calculation Errors in Word 2000
You can kind of suppress the error messages by using the Application.DisplayAlerts property.
Save the current alert setting and then set it to wdAlertsNone. This will make word accept the defaults for any
messages that would be displayed. Then at the end of your procedure turn the alerts back on by setting it to
the saved setting.
Re: Suppress Merge Field Calculation Errors in Word 2000
Thank you for taking the time to reply.
As you can see in the code I posted I have set displayalerts to none however despite this suppressing the dialog boxes it still does not suppress the generation of the mail merge error document.
If there is a specific piece of code to use I'd be much appreciative if you could post it.
As I hurtle forward through cyberspace, the end of my wits is clearly visible on the horizon!
Cheers
xentaur.
Re: Suppress Merge Field Calculation Errors in Word 2000
What do you mean, the table calculates dates? Is it a macro, or VBA code?
Or does is a program used? What are the calculations?
Re: Suppress Merge Field Calculation Errors in Word 2000
I formatted your code for easier reading.
If your query is generating an error from calculating dates then you need to resolve the error in Access since
you already have displayalerts off.
Also, when you do ThisDocument.Saved = True you do realize that its not actually saving the document but
turning off the flag that tells Word if the macro class "ThisDocument" is saved. Dont know why you need
that when your not modifying the macro code.
Re: Suppress Merge Field Calculation Errors in Word 2000
Thanks for the reply
Dates are calculated using field codes within the Word document that use bookmarks as a reference. Only the original date for the calcuations is retrieved from an access table. This date is referenced in the word document as a bookmark (fromdate). This bookmark is then used in field code calcuations to determine the week-end date for 13 consecutive weeks from 'fromdate'. There is no error in the formatting or calculations of the access data, nor any visible problem with the date calcuations in the word fields - but if I remove the table from the word document which contains the calculations, then what remains in the main document merges to formletters with no errors.
I'd like to avoid rewriting the date calculations in vba because, as previously stated, the field codes are generating the correct result however something which i cannot pinpoint is causing the merge error.
If the 'mail merge errors' doc cannot be suppressed I'd appreciate a recommendation on the appropriate forum/website to post the field-codes I'm using for scrutiny by superior users.
Much appreciate the response so far.
Cheers
Xentaur.
PS. FYI, the ThisDocument.Saved=true is historic code from the original document which only needed to merge one record, used to prevent users from saving the merged document over the original (I've got some fairly ill-educated end-users).
Re: Suppress Merge Field Calculation Errors in Word 2000
What errors occur if you turn display errors back on?
You may have to post your code and the table so we could look at it.
M$ probably has a service to resolve bugs with their software, unless it turns out not to be a bug, then they charge you. Either way, it'll get fixed, though
Good Luck! :wave:
Re: Suppress Merge Field Calculation Errors in Word 2000
You do realize that "ThisDocument.Saved=true" is referring to your macro code and not the actual document.
To save the actual document you need to do like ActiveDocument.Save to save it or bypass the dirty flag
by doing ActiveDocument.Saved = True.
Without seeing your data calculations or other code it makes it harder and I dont want to be guessing. Can you
attach your document?