TextBox on UserForm

elgringo56

Well-known Member
Joined
Apr 15, 2002
Messages
869
I have several UserForms with TextBoxes for data entry. I notice that when I type into a text box, the first character that I type causes what appears to be an underline to appear thru the entire box. When I finish the entry and either "tab" or "enter" to go to the next TextBox in the tab ordeer, the underline dissappears. I dont really like the underline, but can live with it except for one condition that seems to happen. One of my TextBoxes is for a date. I want to allow the operator to type in the date in any format they desire, ie, 7/3/04 or 7-aug-o4, but, when the operator tabs or enters out of the TextBox, I want to do a "Me.TextBox11 = Format(TextBox11, "dd/mmm/yy")" which will force the format to what I want. This works, however, the underline remains. Is there a way to prevent the underline from appearing there in the first place? I hope this is clear.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
hi Larry long time buddy !!

"Me.TextBox11 = Format(TextBox11, "dd/mmm/yy")"

Try adding a space in front of the text / date and see if that works can be trimed after if needs be.

"Me.TextBox11 = " " & _
Format(TextBox11, "dd/mmm/yy")"

So maybe:

Dim sBT11 as string
Dim vResult as variant
Dim sConv as string

sTB11 = me.textbox11.value
sConv = format(sTB11, "dd/mmm/yy")
sConv = " " &
sConv
vResult = sConv

Me.TextBox11 = vResult

Thats the sort of idea that would juggle the answer - i have not tested this thou. And the code is juts as an exaple of my thinking not a real script as such.

Jack
 
Upvote 0
Hi, Jack, your right, long time no see. Nope, adding the space did not cause the underline to go away. it is frustrating because I have a userform with one entry underlined and it looks like crap. I cant for the life of me figgure out why the underline is there in the first place.
 
Upvote 0
Erm try deleting the text box and add new one change the new one to textbox11 in properties so no re code required

Can you post up the frm and frx forms.. so have a look at ??

Maybe zip them the board might not like them as raw coded ill have a play for you...

Jack
 
Upvote 0

Forum statistics

Threads
1,215,757
Messages
6,126,695
Members
449,331
Latest member
smckenzie2016

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top