Stop pinting

  • Thread starter Thread starter Tricia
  • Start date Start date
T

Tricia

I have a spreadsheet I need to share but which I've protected so no-one can
edit but is it possible to stop them printing it out?
 
hi
you could use the before print event.
Private Sub Workbook_BeforePrint(Cancel As Boolean)
MsgBox ("Printing this file is forbidden.")
Cancel = True
End Sub

open the vb editor (Alt+F11)
in the project window(far left) expand your project(file).
double click "this workbook"
in the code window(far right) click the left drop down arrow.
Click "workbook"
the workbook open event should default. delete it and paste the above code
into the code window.
close the vb editor. save the file.
note: with this code...NO ONE can print.
to remove the code, follow the above procedure except delete the before
print code. now everyone can print again.

Regards
FSt1
 
Thank you.

FSt1 said:
hi
you could use the before print event.
Private Sub Workbook_BeforePrint(Cancel As Boolean)
MsgBox ("Printing this file is forbidden.")
Cancel = True
End Sub

open the vb editor (Alt+F11)
in the project window(far left) expand your project(file).
double click "this workbook"
in the code window(far right) click the left drop down arrow.
Click "workbook"
the workbook open event should default. delete it and paste the above code
into the code window.
close the vb editor. save the file.
note: with this code...NO ONE can print.
to remove the code, follow the above procedure except delete the before
print code. now everyone can print again.

Regards
FSt1
 
Tricia

This can be circumvented by users not enabling macros when they open the
workbook, so don't think the code alone will stop the printing.


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top