Page 132 - Excel Progamming Weekend Crash Course
P. 132
h540629 ch09.qxd 9/2/03 9:33 AM Page 107
SESSION
9
Working with Text
Session Checklist
✔ Displaying text data to the user
✔ Accepting input from the user
✔ Searching for text
✔ Comparing strings
✔ Working with ASCII values
✔ Modifying strings
n Excel program often needs to work with data that is in the form of text (or strings,
as it is called in VBA). The VBA language has a special data type, String, to hold text
A data. It also provides a powerful collection of functions and statements to work with
text data in various ways. These are the topics of this session.
Text Input and Output
An Excel program often needs to get some input from the user or to display a short mes-
sage. VBA’s tools for these tasks are covered in this section.
The MsgBox Function
To display a message to the user, use the MsgBox function. This function displays a message
to the user in a small dialog box and returns a value indicating how the user responded to
the message. Figure 9-1 shows an example.