How to automate Writer using vba?

Hi, I have a (huge) MicroSoft Access application automating MicroSoft Word using VBA.
I would like to replace Word by Writer, this will run on a server.

I need methods to:

  • start writer
  • check if a document is open in writer
  • close a document (eventually without saving)
  • start a new document or open an existing document (eventually from a template)
  • set the cursor on a bookmark (and get an error if bookmark does not exist, OR being able to check bookmark existence)
  • insert a text
  • save the document
  • change the current font in writer (bold, …).

All these stuff is easy to do in ms-office, adding the word reference shows methods and arguments.

Is there any library I can add to vba model for open office?
If not, can you advise me a book or website with full information on libreoffice automation?

Thank you.

VBA works with the API of MS Office documents, LibreOffice has a different API. Therefore a direct use will not be possible. StarBasic (the Basic dialect of LibreOffice) has “Option VBASupport 1” which translates some of the aspects of one document model to the other. Search for that term to learn what is possible.

You find a lot of information in the LibreOffice SDK and on http://api.libreoffice.org/

It is possible to control LibreOffice from other applications. You find some information in the OpenOffice developer guide, e.g. Starting Apache OpenOffice in Listening Mode - Apache OpenOffice Wiki. But I have never done such things. In general, when you search for information you should search for OpenOffice as well.

A total different way is to manipulate the files directly. They are simple zip-containers with pure text files and ODF is a standard with free available documentation.

You will likely get better information contacting the developers directly via IRC irc://chat.freenode.net/libreoffice-dev or mailing list http://lists.freedesktop.org/mailman/listinfo/libreoffice.

I think, you need to be more specific about “MicroSoft Access application”.