Ask LibreOffice - RSS feedhttps://ask.libreoffice.org/en/questions/Questions and answers for LibreOfficeenSun, 22 Sep 2013 18:47:21 +0200LO Basic Macro equivalent to MS Excel VBA line: "If Err.Number = 6 Then OutOfBounds = True"https://ask.libreoffice.org/en/question/22929/lo-basic-macro-equivalent-to-ms-excel-vba-line-if-errnumber-6-then-outofbounds-true/Hi all,
I am trying to translate a MS Excel VBA Macro into one for LO Calc, and there is a line at the beginning of the Sub that reads:
On Error GoTo OverflowTest
Then at the end of the Sub, there is:
Exit Sub
OverflowTest:
If Err.Number = 6 Then OutOfBounds = True
End Sub
Naturally, LO doesn't like this, so what would be the equivalent?
Thanks in AdvanceSat, 21 Sep 2013 12:45:05 +0200https://ask.libreoffice.org/en/question/22929/lo-basic-macro-equivalent-to-ms-excel-vba-line-if-errnumber-6-then-outofbounds-true/Answer by w_whalley for <p>Hi all,</p>
<p>I am trying to translate a MS Excel VBA Macro into one for LO Calc, and there is a line at the beginning of the Sub that reads:</p>
<pre><code>On Error GoTo OverflowTest
</code></pre>
<p>Then at the end of the Sub, there is:</p>
<pre><code>Exit Sub
OverflowTest:
If Err.Number = 6 Then OutOfBounds = True
End Sub
</code></pre>
<p>Naturally, LO doesn't like this, so what would be the equivalent?</p>
<p>Thanks in Advance</p>
https://ask.libreoffice.org/en/question/22929/lo-basic-macro-equivalent-to-ms-excel-vba-line-if-errnumber-6-then-outofbounds-true/?answer=22935#post-id-22935Looks like the error code number is the same but the syntax is slightly different. Try
OverflowTest:
If err = 6 then OutOfBounds = true
end subSat, 21 Sep 2013 16:37:25 +0200https://ask.libreoffice.org/en/question/22929/lo-basic-macro-equivalent-to-ms-excel-vba-line-if-errnumber-6-then-outofbounds-true/?answer=22935#post-id-22935Comment by Dycius for <p>Looks like the error code number is the same but the syntax is slightly different. Try</p>
<pre><code>OverflowTest:
If err = 6 then OutOfBounds = true
end sub
</code></pre>
https://ask.libreoffice.org/en/question/22929/lo-basic-macro-equivalent-to-ms-excel-vba-line-if-errnumber-6-then-outofbounds-true/?comment=22981#post-id-22981Ah.Thank you. :) I hope the error code is the same. There seems to be a lot the same between Excel and Calc, which is nice.
Thanks again.Sun, 22 Sep 2013 18:47:21 +0200https://ask.libreoffice.org/en/question/22929/lo-basic-macro-equivalent-to-ms-excel-vba-line-if-errnumber-6-then-outofbounds-true/?comment=22981#post-id-22981