Bryco 发表于 2007-8-8 16:24:09

好的,所以这变得越来越难了。我让Inputbox错误控制正常工作,但现在其他一切都坏了。

Bryco 发表于 2007-8-8 16:24:31

现在,如果他们按ESC键,我将退出Sub

Bryco 发表于 2007-8-8 17:58:04

这是一个艰难的选择,因为没有太多的选择
这可能有些用处
Sub MOX()
    Dim dblTOC As Double
    Dim sAns As String
    Dim sTitle As String
    sTitle = "What is T.O.C. elevation? ie 12 or 0 or -12"
Repeat:
    sAns = InputBox(sTitle)
    If sAns = "" Then
      Exit Sub
    End If
    If Not IsNumeric(sAns) Then
      sTitle = "Please type a number"
      GoTo Repeat
    End If
    dblTOC = CDbl(sAns)
    Debug.Print dblTOC
End Sub
页: 1 [2]
查看完整版本: 不允许 null 或 esc 或 enterkey 的最佳方法