Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying to capture key presses in a text control on a form and need
to use KeyUp event (vs. Keypress) so I can capture the arrow keys. It doesn't appear that KeyUp distinguishes between '<' and ',' (since they are both the same key on the keyboard). Am I missing something? Is there some event that captures arrow keys AND would distinguish between '<' and ','? Thanks. John |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe I'm missing something (I'm a bit rusty), but this works for me in
Excel XP: Private Sub TextBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) Select Case KeyCode Case 37 MsgBox "Left" Case 38 MsgBox "Up" Case 39 MsgBox "Right" Case 40 MsgBox "Down" Case 188 If Shift = 0 Then MsgBox "Comma" Else MsgBox "Less than" End If Case Else End Select End Sub __________________________________________________ _______________________ "robotman" wrote in message oups.com... I'm trying to capture key presses in a text control on a form and need to use KeyUp event (vs. Keypress) so I can capture the arrow keys. It doesn't appear that KeyUp distinguishes between '<' and ',' (since they are both the same key on the keyboard). Am I missing something? Is there some event that captures arrow keys AND would distinguish between '<' and ','? Thanks. John |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One piece of information that I didn't mention is that the characters
are actually coming from a piece of equipment through a keyboard wedge so there aren't any physical keys being pressed. I was assuming that the KeyUp wouldn't intrepet the "Shift" correctly (since it wasn't actually being pressed), but your code does work. I guess the event looks first at the ASCII it has received and then assigns the SHIFT value and assigns the keycode based on the ASCII. It's interesting that when it receives a "<" from the instrument, it triggers the event twice... once for the ',' and then again for the virtual shift release. Thanks for your help. John |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
CF to distinguish Formulas from Inputs | Excel Worksheet Functions | |||
Date distinguish | Excel Programming | |||
how to distinguish between text cells? | New Users to Excel | |||
Help with inputbox (Distinguish OK from Cancel) | Excel Programming | |||
Detect MsgBox keyUp | Excel Programming |