Back to lesson
1. What function can we use to force an input into a string data type?
2. When running the following code, what will happen if the user clicks OK without entering a value, or hits cancel?
It will keep prompting the user to enter something into the answer area and click OK, no matter how many times they cancel
The code will continue without prompting the user again
If the user clicks OK it will accept it, but if the user clicks Cancel they will be prompted to enter their name again
3. What do you need to do in order to allow the user to cancel out of this loop?
Ask the user to type "Cancel" in the answer area
Change the sAnswer line to sAnswer = CStr(InputBox("Enter your name")) so that you can test if the input is equal to "vbCancel"
Insert a counter and a test in order to only run the loop x times
Back to the top
© 2017 GoSkills Ltd.
Skills for career advancement