Stop user to print out our file ==>


Posted by LOkman on January 25, 2001 11:08 AM

I have create some workbook for my colleague..but they never
appreciate it..they always take my works, put it in the diskette
and bring it home.They don't care about my feeling and never
thanks me. This is what I like you guys to help me. I don't
want them to have hard copy of my files. So I want this :

Whenever they try to print the pages( e.g I have 3 sheets in my workbook)
a input box will appear and asking them for password. If they
can't give the right password. a msg box will appear and
said"you don't have authorized to keep this file as your hardcopy"
And the printing process will be stop immediately.
Is it possible. I'm thinking of something like
private sub workbook_beforeprint..but I don't know how to do it..
Wiil someone helps me on this. Thanks in advance

Posted by Celia on January 25, 2001 4:17 PM


Lokman

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim password As Variant
password = Application.InputBox("Enter password")
If password = False Then
Cancel = True
Exit Sub
End If
If password <> "whatever" Then
Cancel = True
MsgBox "The correct password is required to print this workbook."
End If
End Sub

Also, don't forget to protect the code.

Celia

Posted by Lokman on January 25, 2001 6:25 PM

Thanks.How do you applied it on certain sheets.lets say sheet2 and 3 only....

I have 3 sheets.(sheet1,2 and 3)
let say I want the user to print sheet1
only but not sheet2 and 3..so how do I
applied your code to do these..Thanks again..



Posted by Lokman on January 25, 2001 10:19 PM

I have figured it out..ignored this post..many thanks