Force an Entry Into an InputBox
Previously, I posted this example for capturing Cancel with InputBoxes.
In some development situations, you may need to force the user to make an entry to an InputBox.
The below example is one way to accomplish this, while nullifying the Cancel button and the keyboard’s Esc key to force an entry of some kind. The MsgBox line is just for demonstration purposes, to confirm that an entry was made.
Sub ForceInputBoxEntry() Dim strEntry As String Do Until Len(strEntry) > 0 strEntry = InputBox("Please enter your info:", "Entry is required") Loop MsgBox "You entered " & strEntry, , "Thank you." End Sub
Leave a Reply