Ask Your Question
0

BASIC Runtime Errors [closed]

asked 2012-07-14 01:41:29 +0100

Stephen Leibowitz gravatar image

updated 2013-01-28 23:22:26 +0100

qubit gravatar image

I am trying to convert an Excel 2003 VBA macro to LibO. I have fixed the few syntax problems. The heart of the conversion effort will be in dealing with the two very different APIs. My preference is to Open the Excel xla file and have it run until the first runtime error, which I would then fix. I would repeat the cycle of “run and fix” for the other errors. When I encounter an error, I would also search for and fix similar errors, in order to speed up the conversion effort.

My problem is that the Basic processor often does not provide the error information that I need. The first error message says, BASIC runtime error. '420' Invalid object reference. The end of the module’s code is displayed, but there is no code highlighted or arrow pointing to a particular line. I have no idea which object the Basic processor is complaining about. Pressing the Stop Macro button has no effect. When I press the OK or X button on the message, the macro continues to the next error. That error is, BASIC runtime error. '12' xlApplication Event. But even without me dismissing the message, the processor continues to the next error after a few seconds

I have placed many breakpoints in the code, but this does not seem to help me in isolating the errors.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2015-10-21 00:28:38.210630

1 Answer

Sort by » oldest newest most voted
1

answered 2013-01-28 23:37:29 +0100

qubit gravatar image

Hi @Stephen Leibowitz,

First, let me congratulate you on trying to translate macro code. That doesn't sound like the easiest job!

It sounds like there are a couple of different pieces to your question/your task:

  1. You're trying to convert some code from VBA to LOBasic and would like help
  2. You're running into some limitations of the current Basic IDE in LO
  3. You might be running into some bugs with LOBasic or the IDE

As far as #2 and #3 go, it could be very helpful if you could file a bug (or a few bugs) about these issues. The QA team will be happy to help you triage bugs into errors vs. enhancements. The specific note about breakpoints not helping/working to help isolate errors sounds like something very important to address!

As for your macro conversion, I might be tempted myself to just re-write the macro from scratch. Sure, I'd use the original code as reference, but I'd just look at it and type up the LO code myself. It can be tempting to just iterate on the errors, fixing them until the file opens in LO, however that approach might result in some unexpected behavior, especially if some statement takes different arguments or works slightly differently in MS-Office vs. LO. (I don't write macros much myself -- you may understand the nuances of the compatibility between the languages much better than I!)

Another good tip: Break any macros into several small functions and convert/test each piece separately, then hook them all together at the end.

Good luck!

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2012-07-14 01:41:29 +0100

Seen: 5,927 times

Last updated: Jan 28 '13