I would like to be helpful. It may be difficult, however, in this case, and surely it won't work out in the sense of my general motivation to contribute to a forum like this one.
First of all: Neither Apache (now very little active concerning OpenOffice) nor TheDocumentFoundation maintaining and developing the more vital LibreOffice branch try to lock-in their users. Therefore they don't force them to use a specific (rather powerful but ugly, badly structured, "proprietary") programming language if it comes to any kind of document automation.
As any software working on complex models should do, AOO/LibO provide access to the objects and specialized tools/methods... via an API which basically can be used with code written in different "languages" - if somebody constructed the needed "bridge". The Basic coming with AOO/LibO isn't the API itself, but a kind of simple but usable reference languge providing a short and wide bridge to the API, but very little additional power.
MBT wrote:I am new to macros in OpenOffice.
Welcome!
MBT wrote:I am having trouble figuring out what is wrong with my code.
Of course. You should expect everything wrong for the reasons I tried to explain in advance.
Excel-VBA is a programming language and a kind of API for Excel documents at the same time.
AOO/LibO Basic isn't similar insofar.
I don't know in what ways you can work with AOO/LibO documents while running VBA code started from an MS document, but if you have an open AOO/LibO document (say a spreadsheet model) you can open in addition a document from .xls or .xlsx. As soon as you did so, it is no longer Excel, but a model in RAM to which you have access via the API in exactly the same way as if it was loaded from .ods .
Trying to read your code, I cannot even see clearly with what you started. Was it Excel and VBA? If so I cannot help you at all. Was it a document opened by AOO or LibO? Did you open such a document in a specific way from a program written in an "alien" language? What is the object (variable) representing that model then?
You see: No starting point for specific help so far.
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München