InputBox Function: Type Mismatch Errors

Question:
I have written a small program that calculates geometry problems. I have used input boxes to retreive data from the keyboard, however during runtime if I click the cancel button on the input box I get the error message “Type Mismatch”.This happens in the part of the program that does the calculations (After I’ve got the numbers to calculate).What do I do?

Answer:
You are probably taking the value returned from InputBox and putting it directly into a calculation. You cannot always do this, since the box will be blank if the user presses Cancel. If you check the value against two double quotes first, that should get rid of the type mismatch.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: