Syntax
Len(Source$)
Remarks
Returns the number of characters in Source$.
Example
This example prompts the user to type a name for an AutoText entry and then uses Len() to determine whether the name exceeds the 32-character limit. The On Error instruction prevents the "Command failed" message from appearing if the user cancels the InputBox$() dialog box.
On Error Goto Finish
Start:
a$ = InputBox$("Type a name for the AutoText entry.")
If Len(a$) > 32 Then
MsgBox "Please type no more than 32 characters."
Goto Start
End If
Finish:
See Also
InStr(), Left$(), LTrim$(), Mid$(), Right$(), RTrim$()