R
Robert
Hello,
The following VBA macro captures the BeforePrint event so thet it prints
only the area I defined. The macro presents a PrintPreview to the user, but
in this Preview window there is another Print button which allows the user
to run a second print. I need to forbid that. How can I deactivate this
Print button in the Preview window ?
Thanks for your help,
Robert
---------------------------------------------------
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Cancel = True
Application.EnableEvents = False
Dim Clic As Integer
Application.ScreenUpdating = False
ActiveWorkbook.Protect Structure:=False, Password:="XXX"
With Worksheets("DTimpr")
.Activate
.Visible = True
.PageSetup.PrintArea = "DTfinale"
MsgBox "Click on the CLOSE button to close the preview to print out"
.PrintPreview
Clic = MsgBox("After this previw, do you want to print?", vbYesNo,
"Printing of the DT")
If Clic = vbYes Then
.PrintOut Copies:=1, Collate:=True
End If
.Visible = xlVeryHidden
End With
Worksheets("DTForm").Activate
ActiveWorkbook.Protect Structure:=True, Password:="XXX"
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
End Sub
The following VBA macro captures the BeforePrint event so thet it prints
only the area I defined. The macro presents a PrintPreview to the user, but
in this Preview window there is another Print button which allows the user
to run a second print. I need to forbid that. How can I deactivate this
Print button in the Preview window ?
Thanks for your help,
Robert
---------------------------------------------------
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Cancel = True
Application.EnableEvents = False
Dim Clic As Integer
Application.ScreenUpdating = False
ActiveWorkbook.Protect Structure:=False, Password:="XXX"
With Worksheets("DTimpr")
.Activate
.Visible = True
.PageSetup.PrintArea = "DTfinale"
MsgBox "Click on the CLOSE button to close the preview to print out"
.PrintPreview
Clic = MsgBox("After this previw, do you want to print?", vbYesNo,
"Printing of the DT")
If Clic = vbYes Then
.PrintOut Copies:=1, Collate:=True
End If
.Visible = xlVeryHidden
End With
Worksheets("DTForm").Activate
ActiveWorkbook.Protect Structure:=True, Password:="XXX"
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
End Sub