How to create a Libre Office Macro?

| | 1 min read

Libre Office is an awesome tool which enable you to write your own macro to automate different repetitive tasks. This tutorial will help you to write a macro using BASIC in LibreOffice calc.

Open Libre Office. Click Tools -> Macros -> Organize Dialog Box

It will open a dialog box. There are 3 tabs. Click on Library tab and click New in that. Provide name of the library you are going to create. Click on Modules tab. You can see your library is displayed there with a default module, Module1.

You can edit ti by Edit button or create a new module by clicking New button. Either case Libre Office opens LibreOffice Basic editor. you can get LibreOffice Basic editor by clicking Click Tools -> Macros -> Organize Macros -> LibreOffice Basic menu also.

In the LibreOffice Basic editor add following like of code and save.

REM  *****  BASIC  *****
Sub Main
	MsgBox "Hello World"
End Sub

To run this macro click Tools -> Macros -> Run Macro in LibreOffice. It will open Macro selector dialog box. Select your macro from the library. Then Run button will be enabled. Click Run button to run the macro.

Please let us know if we can provide any further assistance.