Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disable Shortcuts
Is ther a way to disable all keyborad shortcuts in a "For Each" or similiar
-- Roger |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disable Shortcuts
Do you mean shortcuts assigned to macros or all shortcuts, like ctrl-c copy,
or both.. Regards, Peter T "Roger" wrote in message ... Is ther a way to disable all keyborad shortcuts in a "For Each" or similiar -- Roger |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disable Shortcuts
Peter - just the excel ones like ctrl-c copy
-- Roger "Peter T" wrote: Do you mean shortcuts assigned to macros or all shortcuts, like ctrl-c copy, or both.. Regards, Peter T "Roger" wrote in message ... Is ther a way to disable all keyborad shortcuts in a "For Each" or similiar -- Roger |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disable Shortcuts
Sub test()
SetShortcuts True ' disable shortcuts ' SetShortcuts False ' reset shortcuts End Sub Sub DummyMacro() ' no code in the macro MsgBox "DummyMacro" ' just to test End Sub Sub SetShortcuts(bDisable As Boolean) Dim i As Long, j As Long Dim sMacro As String, sKey As String Dim vArr vArr = Array("^", "+^") ' (ctrl, shift-ctrl) sMacro = "'" & ThisWorkbook.Name & "'!DummyMacro" For i = Asc("a") To Asc("z") ' 97 to 122 For j = 0 To 1 sKey = vArr(j) & Chr(i) If bDisable Then Application.OnKey sKey, sMacro Else Application.OnKey sKey End If Next Next End Sub Assigs ctrl & ctrl+shift a to z to the dummy macro. Adapt if you also want to include numbers and the F keys. See OnKey in help Regards, Peter T "Roger" wrote in message ... Peter - just the excel ones like ctrl-c copy -- Roger "Peter T" wrote: Do you mean shortcuts assigned to macros or all shortcuts, like ctrl-c copy, or both.. Regards, Peter T "Roger" wrote in message ... Is ther a way to disable all keyborad shortcuts in a "For Each" or similiar -- Roger |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disable Shortcuts
Actually it seems the Dummy macro is not required at all. Try this -
Sub SetShortcuts(bDisable As Boolean) Dim i As Long, j As Long Dim sKey As String Dim vArr vArr = Array("^", "+^") ' (ctrl, shift-ctrl) For i = Asc("a") To Asc("z") ' 97 to 122 For j = 0 To 1 sKey = vArr(j) & Chr(i) If bDisable Then Application.OnKey sKey, "" Else Application.OnKey sKey End If Next Next End Sub Regards, Peter T "Peter T" <peter_t@discussions wrote in message ... Sub test() SetShortcuts True ' disable shortcuts ' SetShortcuts False ' reset shortcuts End Sub Sub DummyMacro() ' no code in the macro MsgBox "DummyMacro" ' just to test End Sub Sub SetShortcuts(bDisable As Boolean) Dim i As Long, j As Long Dim sMacro As String, sKey As String Dim vArr vArr = Array("^", "+^") ' (ctrl, shift-ctrl) sMacro = "'" & ThisWorkbook.Name & "'!DummyMacro" For i = Asc("a") To Asc("z") ' 97 to 122 For j = 0 To 1 sKey = vArr(j) & Chr(i) If bDisable Then Application.OnKey sKey, sMacro Else Application.OnKey sKey End If Next Next End Sub Assigs ctrl & ctrl+shift a to z to the dummy macro. Adapt if you also want to include numbers and the F keys. See OnKey in help Regards, Peter T "Roger" wrote in message ... Peter - just the excel ones like ctrl-c copy -- Roger "Peter T" wrote: Do you mean shortcuts assigned to macros or all shortcuts, like ctrl-c copy, or both.. Regards, Peter T "Roger" wrote in message ... Is ther a way to disable all keyborad shortcuts in a "For Each" or similiar -- Roger |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disable Shortcuts
Thanks Peter - very useful
-- Roger "Peter T" wrote: Actually it seems the Dummy macro is not required at all. Try this - Sub SetShortcuts(bDisable As Boolean) Dim i As Long, j As Long Dim sKey As String Dim vArr vArr = Array("^", "+^") ' (ctrl, shift-ctrl) For i = Asc("a") To Asc("z") ' 97 to 122 For j = 0 To 1 sKey = vArr(j) & Chr(i) If bDisable Then Application.OnKey sKey, "" Else Application.OnKey sKey End If Next Next End Sub Regards, Peter T "Peter T" <peter_t@discussions wrote in message ... Sub test() SetShortcuts True ' disable shortcuts ' SetShortcuts False ' reset shortcuts End Sub Sub DummyMacro() ' no code in the macro MsgBox "DummyMacro" ' just to test End Sub Sub SetShortcuts(bDisable As Boolean) Dim i As Long, j As Long Dim sMacro As String, sKey As String Dim vArr vArr = Array("^", "+^") ' (ctrl, shift-ctrl) sMacro = "'" & ThisWorkbook.Name & "'!DummyMacro" For i = Asc("a") To Asc("z") ' 97 to 122 For j = 0 To 1 sKey = vArr(j) & Chr(i) If bDisable Then Application.OnKey sKey, sMacro Else Application.OnKey sKey End If Next Next End Sub Assigs ctrl & ctrl+shift a to z to the dummy macro. Adapt if you also want to include numbers and the F keys. See OnKey in help Regards, Peter T "Roger" wrote in message ... Peter - just the excel ones like ctrl-c copy -- Roger "Peter T" wrote: Do you mean shortcuts assigned to macros or all shortcuts, like ctrl-c copy, or both.. Regards, Peter T "Roger" wrote in message ... Is ther a way to disable all keyborad shortcuts in a "For Each" or similiar -- Roger |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Disable keyboard shortcuts | Excel Discussion (Misc queries) | |||
Disable the built-in keyboard shortcuts | Excel Programming | |||
disable shortcuts | Excel Programming | |||
Disable keyboard shortcuts in formula edit mode? | Excel Programming | |||
How to disable the shortcuts of excel files created by MSExcel 20. | Excel Discussion (Misc queries) |