Home > Microsoft Office > Microsoft Word – Prevent Printing

Microsoft Word – Prevent Printing


Like many others, we try and discourage users from printing documents unnecessarily and instead send or share them electronically. However, this doesn’t always work and documents are still printed.

With this simple solution, if the user tries to print, a dialog box immediately appears informing the user “This document cannot be printed” (or words of your choosing!) and the print command is cancelled.
You can prevent Word from printing a document by adding a small peice of code which will disable Ctrl+P, File > Print, and the Print toolbar button.

From within your document (or template), click on Tools > Macros > Visual Basic Editor  (or Alt+F11).

In the top left window, double click on ‘ThisDocument’.

Simply paste the code below into the code window on the right, change the message you wish to be displayed, and press Save. Close the Visual Basic Editor, and close your document.

The next time this document is opened, the code will take effect and printing is disabled.

This technique can also be applied to your company templates so that all documents have this feature installed by default.

 

Dim WithEvents WordApp As Application

Private Sub Document_New()
    Set WordApp = Application
End Sub

Private Sub Document_Open()
    Set WordApp = Application
End Sub

Private Sub WordApp_DocumentBeforePrint(ByVal Doc As Document, Cancel As Boolean)

    'Text displayed to the user if they try to print
    strMessage = "This document cannot be printed."

    MsgBox strMessage, vbOKOnly + vbExclamation, "Print"
        Cancel = True

End Sub
About these ads
  1. August 12, 2011 at 6:58 am | #1

    I’m wondering where I can find that code you’re saying?

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.