ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   UCase in textbox, help (https://www.excelbanter.com/excel-programming/285570-ucase-textbox-help.html)

CAA[_4_]

UCase in textbox, help
 
I don't know what is wrong here.
I get a can't find project or library error.
Any suggestions peeps?

Private Sub TextBox1_AfterUpdate()
Dim st As String
st = TextBox1.Value
UCase (st)
TextBox1.Value = st
End Sub

Thanks for looking
CAA


---
Message posted from http://www.ExcelForum.com/


Harald Staff

UCase in textbox, help
 
Hi Caa

This
UCase (st)
is not a command, it's a value. So it does nothing. Try simply

TextBox1.Text = Ucase(TextBox1.Text)

Or if you want to do this on entry, which sometimes is a good idea:

Private Sub TextBox1_KeyPress(ByVal _
KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 97 To 255
KeyAscii = Asc(UCase$(Chr$(KeyAscii)))
Case Else
End Select
End Sub

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"CAA" wrote in message
...
I don't know what is wrong here.
I get a can't find project or library error.
Any suggestions peeps?

Private Sub TextBox1_AfterUpdate()
Dim st As String
st = TextBox1.Value
UCase (st)
TextBox1.Value = st
End Sub

Thanks for looking
CAA


---
Message posted from http://www.ExcelForum.com/




KM[_2_]

UCase in textbox, help
 
Hi,
Thats because your code is wrong, use

TextBox1.Value = Ucase(TextBox1.Value)

regards
KM

-----Original Message-----
I don't know what is wrong here.
I get a can't find project or library error.
Any suggestions peeps?

Private Sub TextBox1_AfterUpdate()
Dim st As String
st = TextBox1.Value
UCase (st)
TextBox1.Value = st
End Sub

Thanks for looking
CAA


---
Message posted from http://www.ExcelForum.com/

.


CAA[_5_]

UCase in textbox, help
 
Thanks for the help. I'm fairly new to VBA and i couldn't figure it
out.
Simple when you know how.
thanks again.


---
Message posted from http://www.ExcelForum.com/


CAA[_6_]

UCase in textbox, help
 
Oh dear,
I'm still getting the error, I've tried both options.
What i'm trying to do is make sure the information is being transfered
from a textbox on a form to a cell and in uppercase.

Is it possible to do it on the fly? or something that will turn on caps
lock?


---
Message posted from http://www.ExcelForum.com/


Harald Staff

UCase in textbox, help
 
Did you try my keypress code ?

--
HTH. Best wishes Harald
Followup to newsgroup only please

"CAA" skrev i melding
...
Oh dear,
I'm still getting the error, I've tried both options.
What i'm trying to do is make sure the information is being transfered
from a textbox on a form to a cell and in uppercase.

Is it possible to do it on the fly? or something that will turn on caps
lock?


---
Message posted from http://www.ExcelForum.com/




CAA[_7_]

UCase in textbox, help
 
Yes,
I tried the keypress code and got the same error at the
Asc(UCase$(Chr$(KeyAscii))) line,
at the Chr$ part. can't find object or library.


---
Message posted from http://www.ExcelForum.com/


Harald Staff

UCase in textbox, help
 
Sorry for missing the library thing in your original post. In the VBEditor, go Tools
References and uncheck everything "missing".

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"CAA" wrote in message
...
Yes,
I tried the keypress code and got the same error at the
Asc(UCase$(Chr$(KeyAscii))) line,
at the Chr$ part. can't find object or library.


---
Message posted from http://www.ExcelForum.com/




CAA[_8_]

UCase in textbox, help
 
No joy i'm affraid.
There are lots of references i could add, however there is about
visual basic for applications references which when selected give
name conflict with current module.
Is there a reference in particular that i need?

CA

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

UCase in textbox, help
 
You shouldn't be adding references, you should be unchecking the one that
says MISSING.

--
Regards,
Tom Ogilvy

"CAA" wrote in message
...
No joy i'm affraid.
There are lots of references i could add, however there is about 5
visual basic for applications references which when selected give a
name conflict with current module.
Is there a reference in particular that i need?

CAA


---
Message posted from http://www.ExcelForum.com/




CAA[_9_]

UCase in textbox, help
 
Sorry,I totaly missed the mark there

Thanks alot, that worked brilliantly, all is good.

I can't imagine how on earth that helped but it did

CAA


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 08:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com