How to force proper case in textbox
Proper Text is nothing but each word will have it’s first letter in caps. If you want to change every first letter of each word in a sentence then you can use StrConv function of VB in VBA.
String(Mandatory) String is the String which you want to make in Proper Case.
Conversion as StrConv(Mandatory): This is set of Conversion type which is available under this function. Below are the main types which are used frequently:-
vbLowerCase This will convert string in lower case
vbUpperCase This will convert string in Upper case
vbProperCase This will convert string in Proper case
LocaleID: This an optional input.
How to make every first letter of a word in Capital letter of a Textbox: Copy and Paste the below code in Textbox Change Event. This is the simplest way to force proper case in textbox
Private Sub TextBox1_Change() TextBox1.Text = StrConv(TextBox1.Text, vbProperCase) End Sub
Read This Also:
- How to force input to Uppercase or Lowercase in a Textbox
- Textbox first Letter in Caps and Rest other in Lowercase
My name is Vishwamitra Mishra. Friends Call me Vishwa. This blog is authored by me. I am an Excel Geek. Well, this blog talks a lot about my passion in Excels & Macros so I’ll not talk about it :) I am very much passionate about traveling & quite recently discovered that I am a good photographer too..:P
AND GET A FREE!
E-BOOK FOR EXCEL VBA BEGINNERS
DON'T MISS ANY NEW ARTICLE !
Get your FREE! E-Book & Have Every New Article Delivered Straight To Your Email-Box