String length of Inputbox user input.

H

Hersh

Hi,
I want to return the string length of the input a user
gives in an inputbox in VBE. Any suggestions?
Hersh.
 
H

Harald Staff

Hi Hersh

Sub test()
Dim S As String
S = InputBox("Say what")
MsgBox Len(S) & " characters"
End Sub

Length 0 means no message or "Cancel", very useful to trap that event.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top