Jaymond Flurrie
Well-known Member
- Joined
- Sep 22, 2008
- Messages
- 921
- Office Version
- 365
- Platform
- Windows
I have an inputbox where I ask user to input something. I don't accept a null string, but I have to see if he pressed cancel. How do I capture the cancel event? Right now my code looks like:
And pressing cancel result in an error or gives that "Can't input nothing!" message. How to fix it?
Code:
Do While strTest = vbNullString
strTest= InputBox("Input something", "I ask")
If strTest= vbNullString Then
Call MsgBox("Can't input nothing!", vbCritical, "I ask")
ElseIf strTest= vbCancel Then
Exit Sub
Else
Exit Do
End If
Loop
And pressing cancel result in an error or gives that "Can't input nothing!" message. How to fix it?