Get String Length Method
The Get String Length method gets the length of one of the following:
The string that the string argument contains
The string in the variable that the varName argument identifies
Format A
Len(string)
Len(varName)
The following table describes the arguments that you can use with this method.
Argument | Description |
---|---|
string |
Includes a string or an expression that evaluates to a string. If you use the string argument, then this method returns the number of characters that the string contains. |
varName |
Identifies a variable that contains a string. If the varName argument:
|
Example
The following example returns the length of a name that the user enters, including spaces:
Sub Button_Click
Dim username as String
username = "Chris Smith"
count = Len(username)
End Sub