Results 1 to 8 of 8

Thread: resolved:Suppress Merge Field Calculation Errors in Word 2000

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2003
    Posts
    5

    Resolved 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:
    1. Application.DisplayAlerts = wdAlertsNone
    2. ActiveDocument.MailMerge.Destination = wdSendToNewDocument
    3. ActiveDocument.MailMerge.Execute
    4. ThisDocument.Saved = True
    5. CommandBars("Menu Bar").Enabled = True
    6. CommandBars("standard").Visible = True
    7. CommandBars("Formatting").Visible = True
    8. Application.CommandBars("Menu Bar").Controls("&File").Controls("Save &as...").Enabled = True
    9. 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
    Last edited by xentaur; Apr 6th, 2005 at 07:27 AM. Reason: resolved.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2003
    Posts
    5

    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.

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    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?

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6

    Thread Starter
    New Member
    Join Date
    Aug 2003
    Posts
    5

    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).

  7. #7
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    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!

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width