[RESOLVED] VB6 + Word: How can I avoid margin warning messages?-VBForums
Results 1 to 3 of 3

Thread: [RESOLVED] VB6 + Word: How can I avoid margin warning messages?

  1. #1

    Thread Starter
    Member
    Join Date
    May 2012
    Location
    La Plata, Buenos Aires, Argentina
    Posts
    52

    Resolved [RESOLVED] VB6 + Word: How can I avoid margin warning messages?

    Hello!

    I have a software already running in several enterprises.
    The thing is, when I send MIcrosoft Word to print, sometimes (depending on the client's printer) sometimes Words raises a warning about the margins being off the printer's area. The problem is that I work with an not visible Word object, so the message box stays invisible, keeping the document 'in queue', and I need it to be fast, to 'Continue' always

    Is there any way of avoid this warning message?

    The way I use word is this:

    Code:
    'With reference to 'Microsoft Word 11 Object'
    Dim Obj_Word As Object
    
    'always invisible, and then:
    Obj_Word.PrintOut

  2. #2

    Thread Starter
    Member
    Join Date
    May 2012
    Location
    La Plata, Buenos Aires, Argentina
    Posts
    52

    Re: VB6 + Word: How can I avoid margin warning messages?

    Unbelievable, talk about a shot in the dark!! Here is what I stumbled across on MSDN site when looking for anything related to this problem, works like a champ! ..........Thanks for the responses


    WD97: DisplayAlerts=wdAlertsNone Fails to Suppress Print Error
    The information in this article applies to:
    Microsoft Word 97 for Windows

    This article was previously published under Q163574
    SUMMARY
    When you set the Visual Basic for Applications DisplayAlerts Property equal to wdAlertsNone, you still receive an error message when printing a document whose margins are set outside of the printable region for your printer.

    To prevent the margin error from occurring, you must disable background printing prior to issuing the command to print the document. Once the command to print has completed, you can re-enable background printing.

    The following example Visual Basic for Applications macro demonstrates this process:
    Sub TurnOffAlertsAndPrint()
    ' Store current Background Printing setting.
    Dim x As Boolean
    x = Options.PrintBackground
    ' Turn off error messaging and Background Printing.
    Application.DisplayAlerts = wdAlertsNone
    Options.PrintBackground = False
    ' Print the active document.
    ActiveDocument.PrintOut
    ' Turn on error messaging and restore Background Printing
    ' to original setting.
    Application.DisplayAlerts = wdAlertsAll
    Options.PrintBackground = x
    End Sub

    For more information about DisplayAlerts, from the Visual Basic for Applications Editor, click the Office Assistant, type "DisplayAlerts," click Search, and then click to view "DisplayAlerts Property."

    (from http://www.xtremevbtalk.com/showthread.php?t=55010)

  3. #3
    New Member
    Join Date
    Oct 2017
    Posts
    1

    Re: VB6 + Word: How can I avoid margin warning messages?

    I just came from the future to thank you so much! Im facing this trouble for so many years and your post was perfect to me... THANK YOU!

Tags for this Thread

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.