2

我是 VBA 新手,我有一个关于错误处理的问题......

我在以下设置中有代码。

Sub code()
    On Error GoTo ErrorHandler
    'bunch of code (real code that's running)

    CurrentRow = 1/0
    Exit Sub

ErrorHandler:
    'Error Handling (uses a msgbox and vbyesno)

由于某种原因,我的代码不会进入 ErrorHandler,而是弹出正常的调试错误,运行时错误“11”:

4

1 回答 1

2

在 VBA 编辑器中;

工具 -> 选项 -> 常规

Error Trapping设置为Break on unhanded errors

于 2013-06-26T14:11:13.397 回答