RWayneH
asked on
Userform, ComboBox move TabIndex after list selection
If I have a userform that has a Listcombobox on it. How do I (after a selection is complete on the combobox) automatically move it to the next TabIndex? Also on the same topic of userforms. I have a textbox that will get a large description in it. I would like to have some text in it that says "Add defeat description here:" that hightlights, but when you type it overwrites that default text? Then last, how do I wrap the text in the textbox? It is a larger one, but when the input reaches the outer limit of the box, it scrolls right instead of wraps. Wrap is set to True?? Looking for a little assistance with a userform. Thanks.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
MulitiLn set to True worked!! Thanks. I believe it is a combobox. I click the down arrow or start typing and it autofills. After the autofill I wanted it to move to the next textbox automatically instead of having to press the tab or click in the field. Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yup, that covers the default text in the TextBox.. Cool!!. Going to remove the request to move the cursor after a selection... in more cases than not, we are just typing out the first few chars and pressing tab anyway.
ASKER
Thanks for the help!!
It's much simpler to just use a Label with the TextBox, but this will highlight the Text in the TextBox when the user clicks into it and allow over writing of the test. Note the text is added in the initialize event
Option Explicit
Private Sub cmdEnter_Click()
Unload Me
End Sub
Private Sub TextBox1_Enter()
With Me.TextBox1
.SelStart = 0
.SelLength = Len(.Text)
End With
End Sub
Private Sub UserForm_Initialize()
Me.TextBox1.Text = "Enter a description here"
End Sub
EE-sellength.xlsm
Bit quick deciding, but pleased to help
If you don't want to see the blinking cursor at all when the userform opens, then add a small second textbox and change the UserForm_Activate code to this.
In any case you're welcome and I'm glad I was able to help.
If you expand the “Full Biography” section of my profile you'll find links to some articles I've written that may interest you.
Marty - Microsoft MVP 2009 to 2016
Experts Exchange MVE 2015
Experts Exchange Top Expert Visual Basic Classic 2012 to 2015
Private Sub UserForm_Activate()
TextBox1.ForeColor = RGB(160, 160, 160)
TextBox1.Text = "Add defeat description here:"
TextBox2.SetFocus
TextBox2.Left = -2000
End Sub
In any case you're welcome and I'm glad I was able to help.
If you expand the “Full Biography” section of my profile you'll find links to some articles I've written that may interest you.
Marty - Microsoft MVP 2009 to 2016
Experts Exchange MVE 2015
Experts Exchange Top Expert Visual Basic Classic 2012 to 2015
Can you attach your workbook?