P
Peter
Hi there,
I've put this code in the Workbook_BeforePrint event and when choosing a
printpreview I notice that when pressing escape, Excel shows the preview
again. Only after pressing the escape for the second time, Excel goes back
to normal view.
Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Application.EnableEvents = False
If ActiveSheet.Name = "Weekform" Then ActiveSheet.PageSetup.PrintArea =
_
Range("Weekform_PRINT").Address
If Range("User") = "" Then Range("User") = UserName 'Using JWalk's
function for retrieving logged-in user
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Application.EnableEvents = True
End Sub
How do I prevent the second printpreview, and therefore also the second
printing of the sheet when not going for the preview ?
I've tried using "Cancel = True" right after the Private Sub
Workbook_BeforePrint(Cancel As Boolean) line.
Seems not to work
TIA,
Peter
I've put this code in the Workbook_BeforePrint event and when choosing a
printpreview I notice that when pressing escape, Excel shows the preview
again. Only after pressing the escape for the second time, Excel goes back
to normal view.
Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Application.EnableEvents = False
If ActiveSheet.Name = "Weekform" Then ActiveSheet.PageSetup.PrintArea =
_
Range("Weekform_PRINT").Address
If Range("User") = "" Then Range("User") = UserName 'Using JWalk's
function for retrieving logged-in user
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Application.EnableEvents = True
End Sub
How do I prevent the second printpreview, and therefore also the second
printing of the sheet when not going for the preview ?
I've tried using "Cancel = True" right after the Private Sub
Workbook_BeforePrint(Cancel As Boolean) line.
Seems not to work
TIA,
Peter