|
-
May 26th, 2005, 12:16 PM
#1
Thread Starter
PowerPoster
VBA: converting text to uppercase
I know how to convert text to uppercase in the Keypress event in VB but how do you do it using VBA?
Thanks,
Blake
-
May 26th, 2005, 12:26 PM
#2
Re: VBA: converting text to uppercase
Exactly the same way if VBA has a KeyPress event that is.... UCase$() works in VBA I think atleast.
Cheers,
RyanJ
Last edited by sciguyryan; May 26th, 2005 at 12:32 PM.
-
May 26th, 2005, 12:35 PM
#3
Thread Starter
PowerPoster
Re: VBA: converting text to uppercase
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.
-
May 26th, 2005, 12:47 PM
#4
Re: VBA: converting text to uppercase
 Originally Posted by blakemckenna
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.
Have you tried the MSDN VBA reference?
Cheers,
RyanJ
-
May 26th, 2005, 01:00 PM
#5
Thread Starter
PowerPoster
Re: VBA: converting text to uppercase
I stand corrected.....you can use the same statement in VBA as in VB.
-
May 26th, 2005, 01:10 PM
#6
Re: VBA: converting text to uppercase
 Originally Posted by blakemckenna
I stand corrected.....you can use the same statement in VBA as in VB.
Well, thats going to save some searching time 
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...
Cheers,
RyanJ
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|