On Error help article explains the optional 'Local' keyword [1]: > Local: "On error" is global in scope, and remains active until canceled by > another "On error" statement. "On Local error" is local to the routine which ? invokes it. Local error handling overrides any previous global setting. When > the invoking routine exits, the local error handling is canceled automatically, > and any previous global setting is restored. But this explanation is simply wrong. The code just ignores the keyword [2], and so there's no difference when it's used or not. The effects of On Error are always local to the function where it's used. Have been documented that way since https://git.libreoffice.org/help/+/fb403a47daba6f4a3e9540a3bce180ec1970b0d4%5E%21/ (2010). [1] https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03050500.html?DbPAR=BASIC [2] https://opengrok.libreoffice.org/xref/core/basic/source/comp/loops.cxx?r=8ad514c6#469
Indeed the interpreter simply ignores the "Local" keyword. I did some research and it seems that even in MS VBA the "Local" keyword no longer has any effect. It simply exists for backwards compatibility. Notice that current VBA documentation doesn't even mention the "Local" keyword. https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/on-error-statement