Ask Your Question

how to automate Writer using vba? [closed]

asked 2014-07-13 16:03:52 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

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.

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 2016-02-29 16:41:44.134630

1 Answer

Sort by » oldest newest most voted

answered 2014-07-13 23:14:16 +0100

Regina gravatar image

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

It is possible to control LibreOffice from other applications. You find some information in the OpenOffice developer guide, e.g. . 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:// or mailing list .

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

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-07-13 16:03:52 +0100

Seen: 3,260 times

Last updated: Jul 13 '14