Suppressing margin warnings with DisplayAlerts in Word isn't working RRS feed

  • Question

  • I've got a Word macro that's set up to ask for some input, access an Excel spreadsheet to get the remaining data, put that into a label with a QR barcode, and print. My problem is in printing - I get the margin/page size warnings whenever I print to the label printer. I had successfully used Application.DisplayAlerts to suppress them using the following subroutine that I call when printing:

    Sub Print_ShowNoMarginsWarning_DoNotShowPrintDialog()
        With Application
            'Turn off DisplayAlerts
            .DisplayAlerts = 0
            'Print document
            'Background print must be turned off to prevent message
            .PrintOut Background:=False, Range:=wdPrintFromTo, From:="1", To:="1"
            'Turn on DisplayAlerts again
            .DisplayAlerts = wdAlertsAll
        End With
    End Sub

    However, we just got a second label printer, as we print two types of labels depending on what they're being put on to. I therefore edited the code along these lines:

        If Tissue = "10%" Then
            Printer_Name = "CVM-215-VS33-ZEB1"
            Printer_Name = "ZDesigner TLP 2844"
    With Application
        sCurrentPrinter = .ActivePrinter
        .ActivePrinter = Printer_Name
        For A = 1 To copies
            Call Print_ShowNoMarginsWarning_DoNotShowPrintDialog
        .ActivePrinter = sCurrentPrinter
    End With

    While this works to print labels to the correct printers, ONE of the printers is still printing the margin warning, while the other works as I expect. Any thoughts? This has been driving me crazy all day. I'm using Word 2013 on Windows 7 for this.

    Thursday, June 8, 2017 1:23 AM