如何连续捕获某个错误?,请看如下代码:
   
private sub fun()   on error goto err  lbl:
    'do sth1.
  
  exit sub
err:
   if err.number=3721 then 
       'do sth2.
       goto lbl
    end if
end sub
我的本意是,如果发生3721的错误,处理后再重新执行原sth1,在执行sth1时如果发生3721错误又跳到sth2,如果反复,直到执行到正确才跳出.可是第二次发生3721错误时,程序就中断在sth1那儿跳不过去了.请问有什么办法解决此问题?

解决方案 »

  1.   

    谢谢supergreenbean
    改成 Resume一样,我已用另一种变通的方式解决了此问题,但是希望大家解释下为什么不能多交捕获错误?
      

  2.   

    先关掉错误捕获 on error go to 0
    再 on error go to ErrHandlerprivate sub fun()  lbl:
        on error goto err
        'do sth1.
      
      exit sub
    err:
       if err.number=3721 then 
           'do sth2.
           on error go to 0
           goto lbl
        end if
    end sub