Home Office Tips Excel VBA Print in menu and in toolbar disabled
Print in menu and in toolbar disabled PDF Print E-mail

Example how to stop the print function. By clicking the button in the sheet it is still possible. Thus, one can use specific user from binding the buttons in forms. Very useful if you want to connect to the print and other functions. For example, how certain formatting, or save.

 

Code:

Sheet

Add in the sheet a "command button" , with the name: "CommandButton1"

 

Modul1

Public druck

 

This workbook

Private Sub Workbook_BeforePrint(Cancel As Boolean)
   If druck = False Then
      Cancel = True
      MsgBox "Drucken ist nicht möglich!!! " _
         & Chr(13) & "Bitte den Button im Formular verwenden!"
   End If
End Sub

 

Sheet1

Private Sub CommandButton1_Click()
   druck = True
   Application.Dialogs(xlDialogPrint).Show
   druck = False
End Sub

 

 

Drucken_im_Menue_und_Symbolleiste_deaktiviert-VBA.zip