Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default disable shortcut keys

Hi,

I need to disble all Excel's shortcuts such as ctrl+c, etc. I there an
easier way than looping through all the combinations of alt, ctrl, shift and
each key combination and disabling them with application.onkey?

thanks
Chris
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default disable shortcut keys

Saved from a old post

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




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Chris Wilkinson" wrote in message
...
Hi,

I need to disble all Excel's shortcuts such as ctrl+c, etc. I there an
easier way than looping through all the combinations of alt, ctrl, shift and
each key combination and disabling them with application.onkey?

thanks
Chris


Reply
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
Macro Shortcut Key Conflicts with Application Shortcut Keys Jordan Hotzel Excel Programming 0 October 13th 06 06:39 AM
disable alt and control shortcut keys jhahes[_76_] Excel Programming 1 August 15th 06 04:16 AM
Disable CUT via toolbars or shortcut keys sparx Excel Discussion (Misc queries) 0 April 30th 06 08:34 PM
Disable Shortcut Keys Ronbo Excel Programming 1 May 25th 04 03:12 PM
How to DISABLE THE CONTROL BREAK shortcut keys Marcello do Guzman Excel Programming 3 January 9th 04 01:48 PM


All times are GMT +1. The time now is 04:52 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"