Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent users from printing Excel Workbook

Status
Not open for further replies.

rskuse

Technical User
Jul 18, 2002
74
GB
Is it possible to prevent users from printing an Excel Workbook?
The only answer I have found, so far, is to add some VB code and even this I cannot get to work - it is also not a completely safe method as the workbook can still be printed if macros are disabled or via a browser window.
If anyone has a method they could share with me it would be much appreciated.
Thankyou in advance...
 
Using VBA, insert the following code into ThisWorkbook under Microsoft Excel Objects


Private Sub Workbook_BeforePrint(Cancel As Boolean)
Cancel = True
End Sub
 
nope - code is the only way to do it

Double click on ThisWorkbook in VBE
This will open up the workbook events module
Choose "Workbook" from the left dropdown.
Choose "Before Print" from the right dropdown
delete the workbook_open shell that is automatically created
Put the following code in the before print sub

Cancel = true

et voila - users cannot print. Course, they can still do a screen print and paste it elsewhere but there's always a way round - you'll never lock excel down completely - it just isn't designed to be a secure application

Rgds, Geoff
[blue]Si hoc signum legere potes, operis boni in rebus Latinus alacribus et fructuosis potiri potes![/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 
Thanks guys, just what I needed!

(I was typing the code incorrectly before!)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top