Suppressing message “The
margins of section 1 are set outside the printable area of the page. Do you want
to
continue ?” when printing
from VBA
Article contributed by Ibby
You can use the Application.DisplayAlerts property to avoid this message. However, there is a trap. If background printing is turned on, DisplayAlerts will be turned off, then on before the page is sent to the printer. This results in the message still being displayed. If you tun off background printing, execution of the code will stop until the page is sent to the printer. Then you can turn DisplayAlerts back on.
With Application
' Turn off DisplayAlerts
.DisplayAlerts = wdAlertsNone
' Send document to printer but wait
until it
' is sent before turning DisplayAlerts back on
.PrintOut Background:=False
.DisplayAlerts = wdAlertsAll
End With
For two other variants of macos to handle the margins warning, see Print without margins warning