• # Prevent Printing In A Workbook

If you'd like to prevent anyone from printing your workbook, this code will do the trick (subject to the caveat below).

Macro Weaknesses
• If someone disables macros, your code will not run

Versions Tested:
These macros have been tested with Excel 2010, but should also work in Excel 97 and higher without any modifications.

Prevent Printing Any Worksheet In A Workbook:
The following code will prevent printing any worksheet in the workbook, and goes in the ThisWorkbook module. (If you need help with this, click here.)
Code:
```Private Sub Workbook_BeforePrint(Cancel As Boolean)
Cancel = True
End Sub```

I'm afraid that you must be logged in to comment or leave a testimonial. I wish it could be otherwise, but I'm trying to keep my site spam free for everyone's benefit. If you don't yet have an account it's completely free to sign up, and a very quick process. Simply click here to Register. Not only can you post a comment here, but it gives you full access to posts questions in our forum as well!

If you already have an account, and just haven't logged in yet, what are you waiting for? Login Now!

• ### Recent Forum Posts

#### How to Copy From Multiple Sheets Based On 1 Sheets Input

However, I do have one last question. I've edited the sheet and made it into its final format.
We had previously discussed having a specific column,...

Pahickham Yesterday, 10:16 PM

#### Finding values in a range of from/to arrays

My ranges do not overlap, and this seems to be working, thank you very much for your help....

HuRocan Yesterday, 09:46 PM

#### How to calculate combinations

or
=SUMPRODUCT((MID(B20,ROW(\$1:\$99),1)=",")*1)+1...

caabyyc Yesterday, 08:34 PM

#### Finding values in a range of from/to arrays

Yes, your are right, sorry for that.

(revised) B2=IFERROR(LOOKUP(1,0/((A2>=ranges!\$A\$2:\$A\$18)*(A2...

caabyyc Yesterday, 07:51 PM

#### Finding values in a range of from/to arrays

I note that there are gaps between some of your ranges and that none overlap, so a simple formula in B2 of the data sheet:

Code:
`=SUMPRODUCT((\$A2>=ranges!\$A\$2:\$A\$18)*(\$A2=ranges!\$A\$2:\$A\$18)*(\$A2=ranges!\$A\$2:\$A\$19)*(\$A20,ROW(ranges!\$A\$2:\$A\$19),""))`
...

p45cal Yesterday, 07:30 PM