Not a “Final Answer”, more of a places to check list:
Here’s a few resources that should help with your problem.
- OpenOffice Basic Programming Guide
- Programming OpenOffice with Visual Basic
If these do not seem to help, Open Office has it’s own version of basic as well.