Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Thread Tools Display Modes
Old 06-03-2012, 06:50 PM
joatmon joatmon is offline KeyCode Conversion Windows 7 64bit KeyCode Conversion Office 2010 64bit
KeyCode Conversion
Join Date: May 2012
Posts: 14
joatmon is on a distinguished road
Default KeyCode Conversion

I have a textbox on a userform that I am trying to work with the KeyDown event. I'm trying to capture the user's input using the KeyCode. I thought that KeyCode would just return ASCII values, but this is proving not to be the case. Take this very simple code for illustration:

Private Sub txtAnswer_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
    MsgBox (KeyCode)
End Sub
If I enter the number "3" on the keyboard, what comes out is the number 99. I was expecting the number 51 to appear since that is the ASCII value for the character "3".

Can anybody explain this behavior to me? It's probably pretty simple, but I don't know how to translate this.

Thank you!
Reply With Quote
Old 06-06-2012, 05:18 AM
Colin Legg's Avatar
Colin Legg Colin Legg is offline KeyCode Conversion Windows 7 32bit KeyCode Conversion Office 2010 32bit
Join Date: Jan 2011
Location: UK
Posts: 369
Colin Legg will become famous soon enough

Your code returns 51 for me. I saw that you've posted a subsequent question on another thread which suggests that you've found a solution to this. Did you resolve this issue and, if so, what was the cause of the problem and how did you fix it?
Reply With Quote

Thread Tools
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
ost to pst conversion rudihorvath Outlook 0 03-16-2012 07:23 AM
KeyCode Conversion utm to long lat conversion gsrikanth Excel 2 01-17-2012 07:29 AM
KeyCode Conversion Multiple conversion Metamag Word 3 06-20-2011 05:03 PM
KeyCode Conversion pdf to word conversion wordpdf Word 3 05-15-2011 01:58 PM
KeyCode Conversion file conversion ? coltheplumb Excel 1 05-12-2011 01:03 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:38 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2022 DragonByte Technologies Ltd. is not affiliated with Microsoft