ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   disable print (https://www.excelbanter.com/excel-discussion-misc-queries/100433-disable-print.html)

Walter P

disable print
 
is it possibilty to disable users from printing a specific worksheet in a
workbook or for the entire workbook?

Bearacade

disable print
 

The easiest is just to put this in your VBA Module:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Cancel = True
End Sub


--
Bearacade


------------------------------------------------------------------------
Bearacade's Profile: http://www.excelforum.com/member.php...o&userid=35016
View this thread: http://www.excelforum.com/showthread...hreadid=563438


jetted

disable print
 

Hi Walter

same as beararcade with a message box

Private Sub workbook_BeforePrint(Cancel As Boolean)
Cancel = True
MsgBox "Sorry, you cannot Print from this workbook", vbInformation
End Sub


--
jetted
------------------------------------------------------------------------
jetted's Profile: http://www.excelforum.com/member.php...o&userid=17532
View this thread: http://www.excelforum.com/showthread...hreadid=563438


Walter P

disable print
 
Thx Bearacade, but can you put it in laments terms for me?

"Bearacade" wrote:


The easiest is just to put this in your VBA Module:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Cancel = True
End Sub


--
Bearacade


------------------------------------------------------------------------
Bearacade's Profile: http://www.excelforum.com/member.php...o&userid=35016
View this thread: http://www.excelforum.com/showthread...hreadid=563438



Chip Pearson

disable print
 
That code needs to go in the ThisWorkbook code module, not a
regular code module.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Bearacade"
wrote in
message
...

The easiest is just to put this in your VBA Module:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Cancel = True
End Sub


--
Bearacade


------------------------------------------------------------------------
Bearacade's Profile:
http://www.excelforum.com/member.php...o&userid=35016
View this thread:
http://www.excelforum.com/showthread...hreadid=563438




Walter P

disable print
 
Hey Jetted,

Sounds good to me, but how do you do what both bearacade and you are saying
in simplke terms?:)

"jetted" wrote:


Hi Walter

same as beararcade with a message box

Private Sub workbook_BeforePrint(Cancel As Boolean)
Cancel = True
MsgBox "Sorry, you cannot Print from this workbook", vbInformation
End Sub


--
jetted
------------------------------------------------------------------------
jetted's Profile: http://www.excelforum.com/member.php...o&userid=17532
View this thread: http://www.excelforum.com/showthread...hreadid=563438



Bearacade

disable print
 

Walter P Wrote:
Thx Bearacade, but can you put it in laments terms for me?



Ok.. so open your excel spreadsheet. Go to Tools Macros Visual
Basic Editor (or you can just press Alt + F11)

On the left side is the Project Explorer. You should see something
with the name VBAProject (-Name of your excel file-)

Click it if it is not expanded already, and double click on
ThisWorkbook. Put the code in the box that pops up.

HTH


--
Bearacade


------------------------------------------------------------------------
Bearacade's Profile: http://www.excelforum.com/member.php...o&userid=35016
View this thread: http://www.excelforum.com/showthread...hreadid=563438



All times are GMT +1. The time now is 01:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com