Not a 2nd print from the preview

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top