【问题标题】:What is wrong with my inputbox我的输入框有什么问题
【发布时间】:2016-02-24 06:05:14
【问题描述】:
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?我该如何解决?

【问题讨论】:

  • 如何单击取消而不出现该错误?
  • Loop Until jjj = "Master" Or jjj = "" Inputbox 如果按取消返回 False/空字符串,而不是 vbCancel (2)
  • 我之前试过了,但我仍然得到同样的错误 13

标签: vba inputbox


【解决方案1】:
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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多