VBA Error “Bubble Up”

前端 未结 5 2256
不思量自难忘°
不思量自难忘° 2020-12-11 06:37

I haven\'t read much about it, but the author at the link below recommends that I don\'t use \"bubble up\" to centralize error handling in VBA.

Excel Programming Wee

5条回答
  •  情深已故
    2020-12-11 07:06

    I'm not sure what the default error handling of VBA is, but since its Visual Basic for Applications, and those applications include things like excel and word, I assume just a dialog box will appear which will not be helpful to the user.

    I assume that the author has been bitten by code not handling errors so he now recommends all procedures to handle errors.

    The full answer is that you have to be aware of every error that can occur and to have code in place to handle it, whether it is as low as possible (where you may not know what to do), or as high as possible (which means less effort writing error handling code, but not knowing why the error occurred), or strategically (which is just in the right places where you should be able to recover from most common errors) or just everywhere (which may be just too much development effort).

提交回复
热议问题