Returns a Long containing the number of characters in a string or the number of bytes required to store a variable.
Len(string | varname) |
The Len function syntax has these parts:
Part | Description |
string | Any valid string expression. If string contains Null, Null is returned. |
varname |
Any valid variable name. If varname contains Null, Null is returned. If varname is a Variant, Len treats it the same as a String and always returns the number of characters it contains. |
One (and only one) of the two possible arguments must be specified.
Dim MyInt As Integer Dim MyString, MyLen MyString = "Hi all" ' Initialize variable. MyLen = Len(MyInt) ' Returns 2. MyLen = Len(MyString) ' Returns 6. |
See Also |
Data Types, InStr Function |