我的输入框有什么问题

时间:2016-02-24 06:05:15

标签: vba inputbox

Sub weewe()

Dim jjj As String

Do
    jjj = InputBox("Type in the correct password", "password")
Loop Until jjj = "Master" Or vbCancel

If jjj = "Master" Then

    sss = MsgBox("thats the correct password", vbOKOnly, "Password")

ElseIf jjj = vbCancel Then

    Exit Sub

End If

End Sub

代码有效,但为什么当我点击取消时,我得到错误13?我该如何解决?

1 个答案:

答案 0 :(得分:0)

Sub weewe()

    Dim jjj As String

    Do
        jjj = InputBox("Type in the correct password", "password")
    Loop Until jjj = "Master" Or jjj = ""

    If jjj = "Master" Then
        MsgBox "thats the correct password", vbOKOnly, "Password"
    ElseIf jjj = "" Then
        Exit Sub
    End If

End Sub