View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default How to prevent a specific worksheet from being printed !

hmmm....then it does not appear to work. : )

definitely go with changing the printarea to a single empty cell (it looks
like the printer just spits out a blank page. i can't think of anything else
that would not be more trouble than it's worth. it would be nice to have an
after_print event handler.

thanks for pointing that out.

"William Benson" wrote:

What if they say print entire workbook? Can you stop them from doing this
(since, obviously, this will include the active sheet which is undesirable
for printing?)
"JMB" wrote in message
...
I take it your question is how to test to see if a different worksheet
(other
than the active sheet is being printed).

I believe when you print, the sheet being printed is the active sheet
(temporarily). Anytime you run a macro to print worksheets (and leave
screenupdating on) you'll see excel activating and looping through the
various worksheets.


"RAFAAJ2000" wrote:

Hi all,

I have used the following code but this assumes the specific WorkSheet is
the active WorkSheet which is not necessarly always the case.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
MsgBox " Printing Cancelled!"
Cancel = True
End If
End Sub


Any ideas ?

Regards.