-
When using the input box function how do you know if the user hits ok or cancel. I have an input box in my program for users to enter a transaction number. If they enter a number and press ok everything goes well. If they do not enter a number and just press cancel then everything crashes, which is not good.
Any help is appreicated.
-
There may be a way to check for Cancel being chosen, much like the MsgBox, but the routine below works too.
Code:
Dim Message, Title
Dim Default, MyValue
Message = "Enter a Deskew value"
Title = "Manual Deskew" '
Default = "5"
MyValue = InputBox(Message, Title, Default)
If MyValue = "" Then ' User selected Cancel
Exit Sub
Else
..... do whatever here
End If
Of course you want to Dimension your variables correctly so they do not default to Variants.
-