Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable all functions and shortcut keys for Excel

Status
Not open for further replies.

ninjamyst

Programmer
Jan 28, 2005
21
US
Hi,

Is there a graceway way to disable all shortcut keys for Excel? I already followed the FAQ faq707-4841 to disable all toolbars. However, I want to prevent users from using keyboard shortcuts. I am writing an application with an embedded Excel.Application object and want to restrict users interaction to only controls I have created. The FAQ suggested the use of Application.OnKey method but that requires manually setting the string to "^B", "^C", and etc. Is there a way to have VBA return a list of all available shortcut keys and loop through the list? If not, what string do I use to represent "Ctrl + Shirt + F1" or something? Thanks!!

~ninjamyst
 
with an embedded Excel.Application object
Isn't OWC more manageable ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I am just adding an functionality to a complex application that requires Excel. My functionality only need to display excel worksheets and allow the user to hide or unhide cols/rows using my controls. It's probably easier to just convert excel worksheet data to a grid or table or OWC as you suggested. However, this is the way my company wants it implemented.
 
Hi ninjamyst,

I would love to be proved wrong on this but AFAIK there is no way to get shortcut key settings straight out of Excel. You could use API calls to get the Windows ones but Excel does not make the settings available in any collection. I find this very frustrating as Word does make them available.

That said, there is limited scope for user-defined keys in Excel. They can only be assigned to VBA procedures and it should be possible (though not simple) to check all the procedures in all the open workbooks to see if they have any hotkey settings. I've never tried disabling the built in ones but I think they are fixed and documented so you should be able to hard code them, although there are quite a few.

Finally, why bother? If a user has an interface they can still get round it so what are you trying to achieve?

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Just a thought, what about the OnKey method assigning a fake procedure for all the keyboard shortcuts to disable ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top