Print Without Margins Warning
Most printers cannot print to the edge of the paper. If you attempt to print a document with content that is outside the printable area of the page, a warning will tell you that there is a problem. You can choose to ignore the problem or you can cancel the print operation in order to fix the problem. There may be times when you want to suppress the warning and print the entire document despite of the margins problem. This article provides a couple of macros you can use for that purpose.
About the margins warning
The illustration below shows the warning that appears if you attempt to print a document with too narrow margins for your printer:
Note the message refers to "section 1" in this case. Since margins are properties of sections, the warning may appear several times if you attempt to print a document with several sections. This could, for example, be the case in relation to documents created via mail merge.
Two different macro versions are included below. Both macro versions suppress the margins warning. If you add one of the macros to your Normal.dotm template, you can use that macro for printing your special documents. You could assign a keyboard shortcut to the macro or assign the macro to a toolbar button in order to make it easy to print your documents.
Macro solution
Macro 1 – no margins warning – no Print dialog
The macro below will suppress the margins warning and print the active document without showing the Print dialog box:
Sub Print_ShowNoMarginsWarning_DoNotShowPrintDialog()
With Application
'Turn off DisplayAlerts
.DisplayAlerts = wdAlertsNone
'Print document
'Background print must be turned off to prevent message
.PrintOut Background:=False
'Turn on DisplayAlerts again
.DisplayAlerts = wdAlertsAll
End With
End Sub
Macro 2 – no margins warning – show Print dialog
The macro below will also suppress the margins warning but as opposed to the macro above, the Print dialog box will be shown, letting you specify the desired print settings:
Sub Print_ShowNoMarginsWarning_ShowPrintDialog()
Dim bPrintBackgroud As Boolean
'Save current setting of background printing
bPrintBackgroud = Options.PrintBackground
Options.PrintBackground = False
'Turn off DisplayAlerts
Application.DisplayAlerts = wdAlertsNone
Dialogs(wdDialogFilePrint).Show
'Turn on DisplayAlerts again
Application.DisplayAlerts = wdAlertsAll
'Set original background printing setting
Options.PrintBackground = bPrintBackgroud
End Sub
About Application.DisplayAlerts
Note that the following code line suppresses not only the margins settings warning but all other types of warnings too:
Application.DisplayAlerts = wdAlertsNone
Since Word does not automatically set DisplayAlerts back, the last line is used to set DisplayAlerts back to show all alerts again.
Related information
See About VBA Macros and Code Snippets and How to Install a Macro for basic information about the macros available on this website and for information about how to install macros.