Messages and User Inputs
Exercise 5.01
Exercise 5.01
The aim of this exercise is to ask the user a series of questions using basic input boxes and present their responses in the form of message boxes.
Files Needed
You don't need any files for this exercise.
Instructions
- Create a new workbook, insert a module and begin a new subroutine.
- Write code to display an input box which asks the user to enter their name and capture the result in a variable.

You can use either a VBA or an Excel input box for this example.
- Add code to display a message and exit the procedure if the user doesn't enter a name or clicks Cancel.

Your error message could resemble this one.
- Add code to display a second input box which asks the user to enter their date of birth. Capture the result in a String variable.

You could display today's date in a particular format to help the user enter a valid date.
- Add code to check that the user has entered a valid date. If so, assign the value to a Date variable. If not, display a message to the user and exit the procedure.

Your error message could resemble this one.
- Add code to display a message box which summarises the user's input and asks if they would like to proceed. Capture the result in a variable.

Your summary message could resemble this one.
- Test which button the user clicked. If the user clicks Yes, display a message which welcomes them to the application.

What the application does is anyone's guess.
- Add a different message if the user clicks No.

Your message can be ruder than this if you like.
Answer Files
You can click here to download a file containing an example answer.
This page has 0 threads
Add post