Userform text box formatting

J

Jock

Is it possible to force Proper Case for any text typed into a User Form text
box?
Thanks.
 
D

Dave Peterson

No. But you can change it whenever you want--when the user leaves the textbox
(Textbox1_AfterUpdate???)
 
R

Rick Rothstein

As long as your TextBox will not contain too much text (things might get
sluggish otherwise), you can probably use this KeyUp event code to do what
you want...

Private Sub TextBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
Dim Position As Long
Position = TextBox1.SelStart
TextBox1.Text = StrConv(TextBox1.Text, vbProperCase)
TextBox1.SelStart = Position
End Sub
 
Top