How do I stop a worksheet from being printed


Posted by Sean on April 06, 2000 12:59 PM

I am quite new to excel but I would like to prevent anybody from taking a Hardcopy of a particular worksheet.
I have put the following code into the before print workbook event and it displays the message OK but then allows printing can anyone help please.

If Activesheet.Name ="Test" Then
MsgBox "this sheet cannot be printed",VbOKOnly,"Non Print Test",0, Cancel = True
end if

I even tried putting in an Application.quit statement after the end if to stop it getting to the print dialog but that did not work.

Am I using this routine correctly? Or is it not possible to prevent printing.
Any Help would be gratefully received
Thanks in advance

Posted by Ivan Moala on April 06, 2000 2:32 PM

Slight change in the above gets it going

If Activesheet.Name ="Test" Then
MsgBox "this sheet cannot be printed",VbOKOnly,"Non Print Test":Cancel = True
end if

Ivan



Posted by Sean on April 07, 2000 5:19 AM

Thanks

Thank you very much for your help.
The code works just fine now

Thanks
Sean