OnKey gives all capital letters?

  • Hey gurus,
    I'm trying to use Application.OnKey commands for upper and lower case letters, but it seems like Excel always uses upper case letters (chars 65 to 90) rather than using lower case letters (chars 97 to 122).

    To be more specific: When I activate OnKey calls for all letters (65:90 and 97:122) and I press a lower case letter such as "e" I should get the character number 101, but instead I get the character number 69.

    Can anyone shed some light on this?

  • Re: OnKey gives all capital letters?

    OnKey uses KeyCodeConstants not the ASCII character values and therefore does not distinguish between upper and lower case letters

    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • Re: OnKey gives all capital letters?

    rory, thank you for the clarification. Glad to know it's a "feature", not a bug.

    royUK, the point of my code is a bit beyond what I want to explain right now. I'll find a workaround for this section, if and when I get stuck I'll post again. I just don't want to use up valuable Guru time for sections that I know I can figure out myself. :D I really appreciate the willingness of people on this forum to help and I don't want to abuse their time.


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!