VBA STRCONV Function (Syntax + Example)

Last Updated: June 22, 2023
puneet-gogia-excel-champs

- Written by Puneet

The VBA STRCONV function is listed under the text category of VBA functions. When you use it in a VBA code, it can convert a string into a specified format. There is a total of 9 different types of formats that you can convert to.

Syntax

StrConv(String, Conversion, [LocaleID])

Arguments

  • String: The string you want to convert.
  • Conversion: A VbStrConv enumerator specifies the type of conversion that is to be made.
  • [LocaleID]: The localeID to be used [This is an optional argument and if omitted VBA takes system LocaleID by default].

Example

To practically understand how to use the VBA STRCONV function, you need to go through the below example where we have written a vba code by using it:

example-vba-strconv-function
Sub example_STRCONV()
Range("B1").Value = StrConv(Range("A1"), vbProperCase)    
End Sub

In the above code, we have used the STRCONV to convert the string that we have in cell A1 into a proper case string.