Unfortunately, alt isn't a standard key... so you're pretty much going to have to use the key up and key down events if you want full detection of what they're doing...
is key down - alt is keycode 18 shift 4, key up - just keycode 18 since it's no longer pressed...
numbers on the numeric keypad are listed as 96 through 105 (0 through 9) as opposed to 48 through 57 at the top of the keyboard.
you could do it this way, but it could probably be written better... (4:50 am, im tired)
also though i don't see why you wouldn't just let the user type stuff in with the alt keys / numeric keypad on their own? i'd think it would double type if you both convert their input and make them type it in..? ie: alt 097 would produce 'a' normally, but coding control for it as well would produce 'aa', no?
option explicit
private bALT_Down as boolean
private lKeyCode as long
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
if keycode = 18 and shift = 4 then
bALT_Down = true
else
if bALT_Down = true then getKey(KeyCode)
end if
end sub
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
if keycode = 18 then bALT_Down = false
call GetKeyCode
end sub
private sub getKey(keyCode as long)
if keycode >= 96 and keycode <= 105 then
lKeyCode = lKeyCode * 10
lKeyCode = lKeyCode + keyCode - 96
end if
end sub
private sub GetKeyCode()
targetcontrol.text = targetcontrol.text + chrw(lKeyCode)
end sub