here's my code:

this code executes by pressing ALT Q, then the msgbox will return the key value of Q which is 81

Private Sub Form_KeyUp(KeyCode As Integer, x As Integer)
If x = vbAltMask Then
    If KeyCode = vbKeyQ Then
        MsgBox KeyCode
    End If
End If
End Sub

actually dis code works but all I want to happen is that every time I hit the ALT Q, its like pressing the numpad7 at the same time...

help me guys.
tnx in advance, merry Christmas

Edited by Nick Evan: Added code-tags

8 Years
Discussion Span
Last Post by vb5prgrmr

So you want to have it seem like you are pressing ALT+Q+7??? Or just 7?

If just 7 then KeyCode = vbKey7

Good Luck


no sir,
each time i press the alt Q, the program should also press the numpad7.
its like hotkey for dota...

ALT Q= numpad7
ALT W= numpad8
ALT A= numpad4
ALT S= numpad5
ALT Z= numpad1
ALT X= numpad2


So then only 7...

If Shift = vbAltMask Then
  If KeyCode = vbKeyQ Then KeyCode = vbKey7
End If

However, I don't see how this code helps you as I did a simple test with a text box and even though I changed the keycode with the above, it did not input it into the text box. I even tried...

If Shift = vbAltMask Then
  If KeyCode = vbKeyQ Then
    KeyCode = vbKey7
    Shift = 0
  End If
End If

and still did not help with resetting shift key. However, text1.text = text1.text & "7" did work but I'll warn you now. Only use the down or up and not both :)...

Good Luck

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.