Hi,
I would want to know what is the code to disable print screen.
I got the code to disable print
So what is the code for print screen?Application.OnKey "^p", ""
please assist me..thanks
Hi,
I would want to know what is the code to disable print screen.
I got the code to disable print
So what is the code for print screen?Application.OnKey "^p", ""
please assist me..thanks
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:
[VBA]Application.CommandBars("File").Controls(15).Enabled = False[/VBA]
The Print Preview command would be a work-around for that, so you could disable that too.
[VBA]Application.CommandBars("File").Controls(14).Enabled = False[/VBA]
If that's not what you're looking for then I don't understand, please explain.
BTW, that code would go into the workbook class:
[vba]Private Sub Workbook_Activate()
Application.CommandBars("File").Controls(14).Enabled = False
Application.CommandBars("file").Controls(15).Enabled = False
End Sub[/vba]
(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.
[vba]Private Sub Workbook_Deactivate()
Application.CommandBars("File").Reset
End Sub[/vba]
Without this the buttons will be permanently disabled, even after you close the WB.
the print screen i mean is....ctrl+prt sc.
See attachment for example
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:
[VBA]Application.OnKey "^p"
Cancel = true
[/VBA]
bump
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link