|
 |  Advantage Series: Microsoft® Word 2002 Sarah Hutchinson-Clifford Glen Coulthard
Exploring Visual Basic for Applications
Case ProblemsGreetings To You Greetings To You keeps a client database in Word. Katie is
figuring out new ways to automate the database. Assume the role
of Katie and perform the steps that she identifies. - Open the "wd12xtra04.doc" Word file and save it as
"Customers" to your personal storage location. Katie has
already created a macro (CreateNewRow) that inserts a new row
at the end of the table. Now, she wants to create a macro
that will get entry from the user and insert it into the
table. She creates a new procedure called GetCustomerData
that displays the following prompts and put the user?s
responses in the appropriate cells of the table.
- Enter customer name.
- Enter customer street address.
- Enter city
- Enter State
- Enter Zip Code
She saves the document and keeps it open for the next
exercise. - Katie wishes to have the new customer data entry
procedure start as soon as the document opens, so she
creates a new procedure called AutoOpen that first calls
the CreateNewRow procedure and then calls the
GetCustomerData procedure. She saves the revised file as
"Customers Revision 1" and closes it. She reopens it to
test her new procedure. After ensuring that the procedure
is working correctly, she keeps the document open for the
next exercise.
- Katie realizes that there will be times when the user
simply wants to view the customer data, so she adds an
If?Then statement to the AutoOpen procedure that
asks the user if they want to add a new record and then
executes the appropriate response. She saves the document
as "Customers Revision 2" and closes the document.
Data File: wd12xtra04 (25.0K) |
|
|