Home Privacy Policy Feedback Link to us Site Map
Loading

MS Excel: StrConv Function (VBA only)


In Excel, the StrConv function returns a string converted as specified.

The syntax for the StrConv function is:

StrConv ( text, conversion, LCID )

text is the string that you wish to convert.

conversion is the type of conversion to perform. The following is a list of valid parameters for conversion.

Parameter Value Description
vbUpperCase 1 Converts the string to all uppercase.
vbLowerCase 2 Converts the string to all lowercase.
vbProperCase 3 Converts the first letter to every word to uppercase. All other characters are left as lowercase. This option is similar to the InitCap function in Oracle.
vbUnicode 64 Converts the string to Unicode.
vbFromUnicode 128 Converts the string from Unicode to the default code page of the system.

LCID is optional. If this parameter is omitted, the StrConv function assumes the system LocaleID.

Applies To:

  • Excel 2007, Excel 2003, Excel XP, Excel 2000

For Example:

StrConv("tech on the net", 1) would return "TECH ON THE NET"
StrConv("TECH ON THE NET", 2) would return "tech on the net"
StrConv("TECH ON THE NET", 3) would return "Tech On The Net"

VBA Code:

The StrConv function can only be used in VBA code. For example:

Dim LResult As String

LResult = StrConv("TECH ON THE NET", vbProperCase)

In this example, the variable called LResult would now contain the value "Tech On The Net".