Excel User Form- Format Proper Case

  • Thread starter Thread starter dpaulos
  • Start date Start date
D

dpaulos

hello,
i have created my first user form, to input names and addresses. i
would like the text to show up as proper case.

can anyone tell me a simple way to accomplish this and also
where this code is supposed to go (ie. in the textbox code, user form
code, etc.).

i'm currently putting code into the private sub for each textbox. this
isn't working.

thanks,
dina
 
dina,

In VBA, what you're looking for is Application.Proper
If you're using a UserForm TextBox, one way would be to use
the After_Update Event of the TextBox.

Example:

Private Sub TextBox1_AfterUpdate()
TextBox1.Value = Application.Proper(TextBox1)
End Sub

John
 
Another way that's built into VBA is to use StrConv:

mystr = StrConv(myStr, vbProperCase)
 
Back
Top