PDA

View Full Version : disable print screen



bear
07-31-2008, 08:50 PM
Hi,

I would want to know what is the code to disable print screen.
I got the code to disable print



Application.OnKey "^p", ""


So what is the code for print screen?
please assist me..thanks

jproffer
08-09-2008, 04:49 PM
What print screen? You mean the screen that comes up when you use the file menu to print? To select the printer from a list, select the pages to print, how many copies, etc?

You could just disable the print command in the File menu:

Application.CommandBars("File").Controls(15).Enabled = False

The Print Preview command would be a work-around for that, so you could disable that too.

Application.CommandBars("File").Controls(14).Enabled = False

If that's not what you're looking for then I don't understand, please explain.

jproffer
08-09-2008, 05:02 PM
BTW, that code would go into the workbook class:

Private Sub Workbook_Activate()
Application.CommandBars("File").Controls(14).Enabled = False
Application.CommandBars("file").Controls(15).Enabled = False
End Sub

(your control numbers may be different depending on your version of excel.)

I prefer to use WB_activate, rather than WB_open because if the user switches to a different workbook, those commands would still be disabled.

Also the counterpart to that code, which is just as, if not more important than the disable, is the ENABLE portion.

Private Sub Workbook_Deactivate()
Application.CommandBars("File").Reset
End Sub

Without this the buttons will be permanently disabled, even after you close the WB.

bear
08-10-2008, 07:53 AM
the print screen i mean is....ctrl+prt sc.

See attachment for example

jproffer
08-10-2008, 08:20 AM
This is purely a guess as I can't see how to trigger the code, or why it's useful, but none-the-less...my guess:

Application.OnKey "^p"
Cancel = true

Aussiebear
08-23-2008, 04:22 PM
bump