Cancel button vs. No Input in Inputbox:   Return to List

Private Sub Command1_Click()
Dim sInput As String
sInput = InputBox("Go ahead ... abuse me", _
            "Dreaded InputBox Demo", _
            "Some default text goes here")
If StrPtr(sInput) = 0 Then
    MsgBox "Cancel was pressed"
Else
    If Len(sInput) = 0 Then
        MsgBox "OK pressed but nothing entered."
    Else
        MsgBox "OK pressed: value= " & sInput
    End If
End If
End Sub



Note to Webmaster