How to disable the print option in Excel using a macro or VBA code. Watch the video below:
There will be times when we do not wish to allow people to print our workbook data. We can achieve this by creating macros that disable the print options available in menus and toolbars. But this will also disable printing of other workbooks if open. An easy option is to cancel printing when the printing process starts by using the following macro code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Cancel = True
End Sub
When you now try to print data, the print process is automatically cancelled. This can confuse the user. Therefore, we can make the above code more user-friendly by giving out a message and now our VBA code will look like this:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Cancel = True
MsgBox “The administrator has disabled printing!”
End Sub
