Disabling Key stroke Short-cuts

  • Thread starter Thread starter Brian Matlack
  • Start date Start date
B

Brian Matlack

Hi!
How can I prevent a user from useing key srtoke short-cuts such as
Ctrl+page to navigate to next sheet? I want to elliminate all key
stroke short-cuts in this workbook. Is this possible? If so How do I
re-enable them so I can work on the book?
Thanks for your help!!
 
Hi Brian

You can use Onkey (see VBA Help)

Try this two macro's

Sub UIT()
Dim K, Key, Key2, i As Integer
On Error Resume Next

For Each Key In Array("+", "^", "%", "+^", "+%", "^%", "+^%")

K = Array("{BS}", "{BREAK}", "{CAPSLOCK}", "{CLEAR}", "{DEL}", _
"{DOWN}", "{END}", "{ENTER}", "~", "{ESC}", "{HELP}", "{HOME}", _
"{INSERT}", "{LEFT}", "{NUMLOCK}", "{PGDN}", "{PGUP}", _
"{RETURN}", "{RIGHT}", "{SCROLLLOCK}", "{TAB}", "{UP}")

For Each Key2 In K
Application.OnKey Key & Key2, ""
Next Key2

For i = 0 To 255
Application.OnKey Key & Chr$(i), ""
Next i

For i = 1 To 15
Application.OnKey Key & "{F" & i & "}", ""
Application.OnKey "{F" & i & "}", ""
Next i
Next
Application.OnKey "{PGDN}", ""
Application.OnKey "{PGUP}", ""
End Sub


Sub AAN()
Dim K, Key, Key2, i As Integer
On Error Resume Next

For Each Key In Array("+", "^", "%", "+^", "+%", "^%", "+^%")

K = Array("{BS}", "{BREAK}", "{CAPSLOCK}", "{CLEAR}", "{DEL}", _
"{DOWN}", "{END}", "{ENTER}", "~", "{ESC}", "{HELP}", "{HOME}", _
"{INSERT}", "{LEFT}", "{NUMLOCK}", "{PGDN}", "{PGUP}", _
"{RETURN}", "{RIGHT}", "{SCROLLLOCK}", "{TAB}", "{UP}")


For Each Key2 In K
Application.OnKey Key & Key2
Next Key2

For i = 0 To 255
Application.OnKey Key & Chr$(i)
Next i

For i = 1 To 15
Application.OnKey Key & "{F" & i & "}"
Application.OnKey "{F" & i & "}"
Next i
Next
Application.OnKey "{PGDN}"
Application.OnKey "{PGUP}"
End Sub
 
There is no way to disable all keyboard short cuts. You would
have to disable each one individually with the OnKey method. That
said, however, why would you want to disable navigation
shortcuts? Your users will hate you for it. I wouldn't use any
Excel product that disabled keyboard shortcuts.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Brian Matlack"
<[email protected]>
wrote in message
news:[email protected]...
 
Back
Top