I know how to convert text to uppercase in the Keypress event in VB but how do you do it using VBA?
Thanks,
Blake
Printable View
I know how to convert text to uppercase in the Keypress event in VB but how do you do it using VBA?
Thanks,
Blake
Exactly the same way if VBA has a KeyPress event that is.... UCase$() works in VBA I think atleast.
Cheers,
RyanJ
VBA does have the Ucase() function, however, in VB I use the following statement in the KeyPress Event.
Text1.Text = Ucase(Asc(Chr(Keyascii)))
By using this statement, everytime you time a letter...it is converted to uppercase regardless if the CAPS Lock is on or not.
Unfortunately, I can't get this to work in VBA.
Well, I'm not shure if VBA has a KeyPress event - and if It does I have no idea what it would be.Quote:
Originally Posted by blakemckenna
Have you tried the MSDN VBA reference?
Cheers,
RyanJ
I stand corrected.....you can use the same statement in VBA as in VB.
Well, thats going to save some searching time :)Quote:
Originally Posted by blakemckenna
And unless you want to return a variant string, use this:
VB Code:
Ucase$(Asc(Chr$(Keyascii)))
And I have one more question..... This:
Is the same as just having this...VB Code:
Asc(Chr$(Keyascii))
VB Code:
Keyascii
Cheers,
RyanJ