https://bz.apache.org/ooo/show_bug.cgi?id=54060
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] Status|ACCEPTED |RESOLVED Resolution|--- |NOT_AN_ISSUE Target Milestone|AOO PleaseHelp |--- --- Comment #6 from [email protected] --- The way AOO Basic works with error handling (see SbiRuntime::Step()) is that errors cannot nest: when already inside an error handler, only the parent error handlers are searched for to handle an error, not the current one. To leave an error handler, you must first "resume" (possibly with a label), only after that will errors use your new error handler instead of trying to go to the parent. In other words: on error goto test x = 0 y = 1/x exit sub test: on error goto test2 msgbox "TEST: " + str(err) +" " + error resume r ' <--------------------------------------- These 2 lines r: ' <--------------------------------------- fix it y = 1/x exit sub test2: msgbox "TEST2: " +str(err) +" " + error exit sub Now you said this "differs from VB6". Are you sure? >From Microsoft for VB.NET (https://msdn.microsoft.com/en-us/library/5hsw66as.aspx) "If the calling procedure has an enabled error handler, it is activated to handle the error. If the calling procedure's error handler is also active, control passes back through previous calling procedures until an enabled, but inactive, error handler is found. If no such error handler is found, the error is fatal at the point at which it actually occurred." Furthermore in Microsoft Office 2007's Excel, even your example has the same error, and mine works. Another error is that you can't refer to err and error after using "on error" in an error handler; that doesn't work even in Excel. Thus resolving NOT_AN_ISSUE. -- You are receiving this mail because: You are on the CC list for the issue.
