PC Review


Reply
Thread Tools Rate Thread

Disable Shortcuts

 
 
Roger
Guest
Posts: n/a
 
      9th Mar 2008
Is ther a way to disable all keyborad shortcuts in a "For Each" or similiar


--
Roger
 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      9th Mar 2008
Do you mean shortcuts assigned to macros or all shortcuts, like ctrl-c copy,
or both..

Regards,
Peter T


"Roger" <(E-Mail Removed)> wrote in message
news:AD6CC27C-7B06-4D14-A898-(E-Mail Removed)...
> Is ther a way to disable all keyborad shortcuts in a "For Each" or

similiar
>
>
> --
> Roger



 
Reply With Quote
 
Roger
Guest
Posts: n/a
 
      10th Mar 2008
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" <(E-Mail Removed)> wrote in message
> news:AD6CC27C-7B06-4D14-A898-(E-Mail Removed)...
> > Is ther a way to disable all keyborad shortcuts in a "For Each" or

> similiar
> >
> >
> > --
> > Roger

>
>
>

 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      10th Mar 2008
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" <(E-Mail Removed)> wrote in message
news1322980-D888-4752-B5C4-(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> > news:AD6CC27C-7B06-4D14-A898-(E-Mail Removed)...
> > > Is ther a way to disable all keyborad shortcuts in a "For Each" or

> > similiar
> > >
> > >
> > > --
> > > Roger

> >
> >
> >



 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      10th Mar 2008
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
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news1322980-D888-4752-B5C4-(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> > > news:AD6CC27C-7B06-4D14-A898-(E-Mail Removed)...
> > > > Is ther a way to disable all keyborad shortcuts in a "For Each" or
> > > similiar
> > > >
> > > >
> > > > --
> > > > Roger
> > >
> > >
> > >

>
>



 
Reply With Quote
 
Roger
Guest
Posts: n/a
 
      20th Mar 2008
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
> news:(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> > news1322980-D888-4752-B5C4-(E-Mail Removed)...
> > > 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" <(E-Mail Removed)> wrote in message
> > > > news:AD6CC27C-7B06-4D14-A898-(E-Mail Removed)...
> > > > > Is ther a way to disable all keyborad shortcuts in a "For Each" or
> > > > similiar
> > > > >
> > > > >
> > > > > --
> > > > > Roger
> > > >
> > > >
> > > >

> >
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
disable shortcuts =?Utf-8?B?Sm9zaCBD?= Microsoft Excel Programming 6 2nd May 2007 05:06 PM
disable advertisement shortcuts Viviana Vc Microsoft Windows 2000 MSI 0 8th Dec 2005 12:42 PM
Disable keyboard shortcuts RzB Windows XP General 5 13th Jul 2004 07:08 PM
disable creating shortcuts Phil Microsoft Windows 2000 Group Policy 2 27th Feb 2004 07:59 AM
Disable Shortcuts in XP IT John Windows XP Security 4 4th Feb 2004 02:41 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:19 PM.