Ask Your Question

Run a macro - how to from a sheet Button, toolbar?

asked 2021-05-03 18:33:09 +0200

vek.m1234 gravatar image

updated 2021-05-03 18:36:10 +0200

In Macros Explained book says that you can run a macro

  1. by placing it first in the module - but in a .ods file, Standard is my first library and clicking 'Run' just opens up an involved Dialog where I need to navigate to my .odt and pickout the module.
  2. use first macro to run everything else - but (1) is already a problem so..
  3. use 'Macro dialog' - well that involves browsing macro run
  4. add a button to doc (or toolbar) - how??
  5. I got the last suggestion working - keyboard shortcut

Is there a quick way to run my test macro vs all this messing about with menus and setup?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2021-05-03 19:13:57 +0200

Ratslinger gravatar image
edit flag offensive delete link more


You can also add or modify a toolbar. See LO documentation -> Getting Started with LibreOffice. See Chapter 14.

Ratslinger gravatar imageRatslinger ( 2021-05-03 20:12:54 +0200 )edit

I tried but the Button does not do anything when clicked.. (after 'Properties' is closed) It's supposed to display a 'Hello World' dialog/by running the Macro. This works via Toolbar

vek.m1234 gravatar imagevek.m1234 ( 2021-05-04 05:57:21 +0200 )edit


Can't see exactly where your macro is located. It should be in the Standard library of My Macros and Dialogs or of the document.

Ratslinger gravatar imageRatslinger ( 2021-05-04 06:10:23 +0200 )edit

oh nm, we need to switch the button Mode to 'Design Mode' off

vek.m1234 gravatar imagevek.m1234 ( 2021-05-04 06:12:50 +0200 )edit

answered 2021-05-03 20:16:57 +0200

Zizi64 gravatar image

How to assign a macro to an user interface item:

Tools - Customize - select a TAB:

  • Menu
  • Toolbars
  • Context menus
  • Keyboard
  • Events

For the Menu, Toolbars, Context menus:

Select the Target and the Scope, and the position from the Function list under the Target. The assigned macro will be located under the selected item.

Then select the Macros from the Category list.

Browse your macro routine from the Macro Function list.

Use the right arrow to assign the macro routine to the position. (the left arrow removes a selected item)

You can modify the Icon of the Toolbar-item, and you can modify the label text of the Menu item and the Context menu item.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2021-05-03 18:33:09 +0200

Seen: 23 times

Last updated: May 03