Microsoft Office Tutorials and References
In Depth Information
Figure 7-2. An InputBox dialog box
Figure 7-2. An InputBox dialog box
The InputBox function returns the string that the user enters into the text box. Thus, in our
example, the string variable sName will contain this string.
Note that if we want a number from the user, we can still use the InputBox function and simply
convert the returned string (such as "12.55") to a number (12.55) using the Val function,
discussed later in the chapter.
7.3 VBA String Functions
Here are a handful of useful functions that apply to strings (both constants and variables):
The Len function
The Len function returns the length of a string—that is, the number of characters in the
string. Thus, the code:
Len("January Invoice")
returns the number 15 .
The UCase and LCase functions
These functions return an all uppercase or all lowercase version of the string argument.
The syntax is:
UCase( string )
LCase( string )
For instance:
MsgBox UCase("Donna")
will display the string DONNA .
The Left, Right, and Mid functions
These functions return a portion of a string. In particular:
Left(string, number)
 
 
Search JabSto ::




Custom Search