我使用下面的代码,当用户点击输入框中的取消按钮时,错误处理程序正在处理错误。
但是如果错误处理程序中再次出现错误,则错误处理程序不会处理该错误。
Sub calculateroot()
Dim msg As String, t as Integer
On Error GoTo myhandle
Dim inp As Integer, sql As Single
inp = InputBox("Enter the number to find the square root")
sql = Sqr(inp)
Exit Sub
myhandle:
t = InputBox("Is this recursive ?")
End Sub
我应该在代码中进行哪些更改来处理错误处理程序中生成的错误?
答案 0 :(得分:1)
您必须重置错误处理程序,然后设置一个新处理程序:
Sub calculateroot()
Dim msg As String, t As Integer
On Error GoTo myhandle
Dim inp As Integer, sql As Single
inp = inputbox("Enter the number to find the square root")
sql = Sqr(inp)
Exit Sub
myhandle:
On Error GoTo -1
On Error GoTo myhandle2
t = inputbox("Is this recursive ?")
MsgBox t
Exit Sub
myhandle2:
MsgBox "myhandle2"
End Sub
答案 1 :(得分:0)
如果你需要恢复,这个恶心的代码可以运作:
content://com.example.android.sunshine.app/weather/
content://com.example.android.sunshine.app/weather/94074
content://com.example.android.sunshine.app/weather/94074/20140612