How to use custom commands in LibreOffice

LibreOffice is one of the most important pieces of free software, allowing many of us to work, study, and share information. Although the software features many tools and capabilities, the spectrum of possible uses for each and everyone out there is so wide, that it is simply impossible to cover every special need with hotkeys and shortcuts. However, LibreOffice can be set to support user-created commands that can essentially help us increase our productivity.

LibreOffice Writer

In my first example, I will show how we can simplify the pasting of the clipboard contents as unformatted text. This is done through the “Ctrl+Alt+Shift+V” shortcut, but this isn't very handy especially if you're pasting unformatted text frequently. Here's a way we can use to change this.
First we need to locate where the command we want to use is. The particular command relies under the “Edit” options where it is contained in the “Paste Special” item.

Next, we go to “Tools → Customize” which is located on the top panel as well. There we choose the “Keyboard” tab, and then the “Edit” category on the lower left. Then we may locate the “Paste Unformatted Text” option and the corresponding active shortcut will be given on the right-side box. Now to choose a new shortcut, navigate on the “Shortcut keys” list and choose the desired key combination. After selecting your choice, hit the “Modify” button, and the shortcut will be assigned to the previously selected function.

If you want to completely get rid of the previous shortcut, select it from the lower right box and hit the “Delete” button. This will leave us with one simplified keyboard shortcut that works for pasting unformatted text.

LibreOffice Calc

Now let's hop to Calc to explore the macros and how we can quickly set them up. First we have to go on “Tools → Options” and we select the “Advanced” category from the list on the left. Then we tick the “Enable macro recording” option to enable it, as shown in the following screenshot.

Then go to “Tools → Macros → Record Macro” and upon pressing it, a little window should appear containing only one button entitled “Stop Recording”. This basically means that every action we do from then on is recorded by LibreOffice.

Let's suppose now that we are preparing customer report cards, a procedure that consists of many repetitive actions. We could start with the creation of a “New Day” macro that would wipe out all fields of data and allow us to enter new customer details at the start of each day.

The changes are only recording for the document that was active when the macro recorder was opened. I choose all the values that change each day, and only leave the “Profit” column untouched as this is calculated automatically.

After removing everything, I click on the “Stop Recording” button and I am prompt to save the macro. Choose the file to save the macro on the file, so even if you use it on another computer or send it to anyone else, the macro will be included.

Now, one way to invoke the macro is by going to “Tools → Macros → Run Macro” but this isn't very handy, especially considering that we added this macro to increase our productivity and make things easier. One way to address this is by adding a button for the macro. Here's how to do it.

To add a button, navigate to “View → Toolbars → Form Control”. This will open up a new window with various options. Choose the “Push Button” option and draw a button anywhere in the document.

Then we need to connect the macro with the pressing of this button. To do this, right-click on the button and choose “Control”, and then click on the “Events” tab on the window that just opened.

Click on the three-dots button which corresponds on the Mouse button pressed event, and a new window will open. Now click the “Macro” button located on the top right.

Navigate the macros again and choose the right one to assign to the button. After having done that, close those configuration windows and then press the “Design Mode On/Off” button on the “Form Control” window that we opened initially. This will activate the button as we will exit the design mode. Your button should be working now. Imagine adding more of these, and you could automate all of the repetitive actions that stress your nerves during everyday work.

Share this page:

2 Comment(s)