PDA

View Full Version : Solved: Create A Short Cut Key in Menu



pachchigar
05-27-2009, 11:56 PM
I want to Create a shortcut key from keyboard menu.
How to Create ?:banghead:

Stormseed
05-28-2009, 01:03 AM
Hi

Could you please explain what type of shortcut key ? Are we talking about the Menu options or some kind of a macro shortcut key ?

pachchigar
05-28-2009, 01:24 AM
i don't want to used mouse.
so that Create in Keyborad shortcut
And Use only Keyboard :banghead:


Hi

Could you please explain what type of shortcut key ? Are we talking about the Menu options or some kind of a macro shortcut key ?

xld
05-28-2009, 01:29 AM
I think you are stuck. A form doesn't respond to Excel shortcuts, and the usual method of & a characater in a button and using Alt-character to invoke it doesn't work on these menu items. You might be able to hook some API in to delegate it to, but I am not sure at this moment what.

pachchigar
05-28-2009, 01:33 AM
Can I Use Faction menu ? About ("F1", "F2"....)

xld
05-28-2009, 01:46 AM
What is Faction Menu?

Stormseed
05-28-2009, 01:52 AM
What is Faction Menu?

I guess, OP means to say "Function Menu" ? not sure..

pachchigar
05-28-2009, 02:17 AM
ya sure "Function Menu"
key on keyboard ("F1" to "F12")

mikerickson
05-28-2009, 07:02 AM
One ugly way to do it would be to use the _KeyDown events of every control in the Userform.

pachchigar
05-29-2009, 02:23 AM
How to Used ?
about the_keyDown events?
Can u Have any Code of keydown?

mikerickson
05-29-2009, 05:46 AM
Put this in the UF code module and mySub will run everytime Shift+F5 is pressed.
Private Sub CommandButton1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode * Shift = 116 Then
Call mySub
End If
End Sub

Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode * Shift = 116 Then
Call mySub
End If
End Sub

Private Sub UserForm_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode * Shift = 116 Then
Call mySub
End If
End Sub

Sub mySub()
MsgBox "x"
End Sub

pachchigar
05-29-2009, 06:38 AM
done. Thank You