Calling a Sub from the User Interface
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:
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.org 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).|