Cancel Printing Except Q
You could add some code to disable events (including the _beforeprint event) in
your code that gets/validates the password.
dim myPwd as string
'some validation here
if mypwd = "oktoprint" then
application.enableevents = false
worksheets("whatever").printout
application.enableevents = true
end if
And the _BeforePrint routine won't even run.
Sean wrote:
I have the following code which prevents priniting of a document. Would
it be possible to allow printing if the correct password was entered
within a userform? So on clicking the Print Icon an input box which
required the password would appear, if it is correct, document prints,
if it isn't document doesn't. If so how would I do it?
Thanks
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Cancel = True
End Sub
--
Dave Peterson
|