LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default VBA or MACRO to prevent someone from printing the contents of an Excel worksheet

Place the following first two macros in the WORKSHEET you want to avoid someone from printing
Place the third macro below into a Module

Basically they does the following things
On activate of a worksheet
1) Disable the "Print" menu ite
2) Replace the Excel shortcut key Ctrl+p with a dummy macro (which contains nothing)
On deactivate of the worksheet
3) Reverse (1) and (2)

'-----Put in the worksheet-----------------------
Private Sub Worksheet_Activate(
Application.CommandBars(1).Controls("File").Contro ls("Print...").Enabled = Fals
Application.OnKey "^p", "dummy_macro
End Su

Private Sub Worksheet_Deactivate(
Application.CommandBars(1).Controls("File").Contro ls("Print...").Enabled = Tru
Application.OnKey "^p
End Su
'-----------------------------------------------------

'-----Put in a module-------------------------------
Private Sub dummy_macro(

End Su
'-----------------------------------------------------


Regards
Edwin Ta



 
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
Prevent user from copying contents of a worksheet Chuck M Excel Discussion (Misc queries) 2 August 28th 08 02:28 AM
new worksheet and rename from cell contents macro Henry Excel Worksheet Functions 1 September 12th 06 10:35 AM
How do I prevent cell contents from printing? Tristan Excel Discussion (Misc queries) 2 March 1st 06 10:17 AM
How to prevent user from printing in Excel? C Wayne Excel Discussion (Misc queries) 3 June 14th 05 09:10 AM
MACRO OR VBA CODE TO PREVENT USERS FROM PRINTING THE CONTENTS OF A WORKSHEET? Marcello do Guzman Excel Programming 1 November 8th 03 12:34 AM


All times are GMT +1. The time now is 04:38 AM.

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"