openoffice-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernard Marcelly <marce...@club-internet.fr>
Subject Re: [QUESTION] On (Local) Error GoTo
Date Mon, 23 Feb 2015 14:02:39 GMT
Hello,

In the Internet, someone said about Access 2000 VBA :
"On Local Error is a remnant from older versions of BASIC (before Visual Basic 
for Applications). In current versions it acts the same as On Error and there is 
no particular reason to use it any more."

I could not find a case where "On Error Local" is different from "On Error".
What is said in the help is also valid with "On Error" : an error handling in a 
called routine suspends the error handling of the caller, until the error 
handling is deactivated or until the called routine terminates. Example hereafter.

Regards
   Bernard

REM  *****  BASIC  *****

Sub Main
Dim c, d
On Error GoTo xx2
d = 0
tata(d)
c = 4/d
MsgBox("Finished")
Exit Sub

xx2:
   MsgBox("Error Main line " & erl)
   Resume Next
End Sub


Sub tata(b)
Dim a
On Error GoTo xx1
titi(b)
a = 3/b
MsgBox("Exit tata")
Exit Sub

xx1:
   MsgBox("Error tata line " & erl)
   Resume Next
End Sub


Sub titi(b)
Dim a
On Error GoTo xx3
a = 3/b
MsgBox("Exit titi")
Exit Sub

xx3:
   MsgBox("Error titi line " & erl)
   Resume Next
End Sub


Message de Mathias Röllig  date 2015-02-22 17:37 :
> Hello!
>
> Can anyone give me an example where
> On Error GoTo
> and
> On Local Error GoTo
> shows a difference?
>
> In my tests I can't find any difference if I use
> On Local Error GoTo
> in a subroutine.
>
> If I understand right the help the error handling should be reset if the
> subroutine was quit.
>
> Regards, Mathias
>

---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscribe@openoffice.apache.org
For additional commands, e-mail: api-help@openoffice.apache.org


Mime
View raw message