Calling a Sub from the User Interface

From Apache OpenOffice Wiki
< Documentation‎ | DevGuide
Revision as of 10:39, 18 January 2024 by DiGro (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

A Sub can be called from customized icons, menu entries, upon keyboard shortcuts and on certain application or document events. The entry point for all these settings is the Customize dialog accessible through the  Assign  button in the Macro dialog or the Tools → Customize command.

To assign the Sub Main to a toolbar icon, select Tools → Customize and click the Toolbars tab. The Toolbars tab looks like this:

Customize Toolbars

Click the  Add  button in the Toolbars tab. In the Add Commands dialog that pops up, scroll down the Category list until you see the OpenOffice Macros node. Expand it and the FirstStepsBasic.odt node. Navigate to the Module FirstStepsBasic.Standard.Module1 and select it. When Module1 is selected, the Commands list shows an entry "Main" for the Sub Main in Module1. Clicking  Add  will add it to a toolbar.

You can now click the new toolbar item to launch the example macros.

The section Assigning Macros to GUI Events describes other options to make your Sub accessible from the user interface.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages