Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default preventing printing in Excel

Interesting discovery. I found this code on an old post:

Private Sub Workbook_BeforePrint(cancel As Boolean)
cancel = True
MsgBox "This page cannot be printed."
End Sub

I put this in, and then protected the worksheet, with autofilter on,
allowing sort and autofilter. The message comes up like it should.
The catch is that if you go to Tools | Macro | VB Editor - you can
delete the code! The code is not protected from being deleted in a
protected workbook!

Wow that is nuts. Just thought I would put this out there.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,268
Default preventing printing in Excel

You can protect it in the VBE, press Alt + F11, find the workbook
in the left project pane, you can right click and select VBAProject
Properties, there you can protect it

Regards,

Peo Sjoblom

misscrf wrote:
Interesting discovery. I found this code on an old post:

Private Sub Workbook_BeforePrint(cancel As Boolean)
cancel = True
MsgBox "This page cannot be printed."
End Sub

I put this in, and then protected the worksheet, with autofilter on,
allowing sort and autofilter. The message comes up like it should.
The catch is that if you go to Tools | Macro | VB Editor - you can
delete the code! The code is not protected from being deleted in a
protected workbook!

Wow that is nuts. Just thought I would put this out there.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default preventing printing in Excel

In the VBE go to Tools - VBA Project properties - Protection - Check off
lock from viewing and add a password...
--
HTH...

Jim Thomlinson


"misscrf" wrote:

Interesting discovery. I found this code on an old post:

Private Sub Workbook_BeforePrint(cancel As Boolean)
cancel = True
MsgBox "This page cannot be printed."
End Sub

I put this in, and then protected the worksheet, with autofilter on,
allowing sort and autofilter. The message comes up like it should.
The catch is that if you go to Tools | Macro | VB Editor - you can
delete the code! The code is not protected from being deleted in a
protected workbook!

Wow that is nuts. Just thought I would put this out there.


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default preventing printing in Excel

Excel supports lots of levels of protection.

You can protect the workbook with a password to open (file|saveAs|general
options)

You can protect the workbook so that sheets can't be
renamed/moved/deleted/inserted (tools|Protection|protect workbook)

You can protect the locked cells on a worksheet (tools|Protection|protect sheet)

And you can protect the workbook's project.
Inside the VBE
tools|VBAProject Properties|Protection tab.

(Each of these protections can be broken--some easier than the others.)

You want that VBAProject protection.

misscrf wrote:

Interesting discovery. I found this code on an old post:

Private Sub Workbook_BeforePrint(cancel As Boolean)
cancel = True
MsgBox "This page cannot be printed."
End Sub

I put this in, and then protected the worksheet, with autofilter on,
allowing sort and autofilter. The message comes up like it should.
The catch is that if you go to Tools | Macro | VB Editor - you can
delete the code! The code is not protected from being deleted in a
protected workbook!

Wow that is nuts. Just thought I would put this out there.


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? Richard Excel Discussion (Misc queries) 2 May 13th 23 12:46 PM
Multiple Excel versions. Naveen Mukkelli Excel Discussion (Misc queries) 0 May 16th 06 01:55 AM
Contact List in Excel - Printing Labels in Word Laura Excel Discussion (Misc queries) 4 March 22nd 06 07:50 PM
How do I 2 worksheet duplex printing with MS Excel 2003? aviavy Excel Discussion (Misc queries) 1 March 9th 06 06:20 AM
Excel Range Value issue (Excel 97 Vs Excel 2003) Keeno Excel Discussion (Misc queries) 2 June 13th 05 03:01 PM


All times are GMT +1. The time now is 06:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"