Hello.
So I'm trying to add some simple command buttons in Open Office calc, which I need to do the following two types of actions when pressed:
- Write the cell value from Cell A1 to Cell A2
- Print range B2:C3 if Cell A3 contains text; else print D2:E3
Thing is, I know neither the code for these actions, nor (and more importantly) where to put the code. I tried right-clicking and navigating all sorts of menus, but the "put the code for when you press the button" option is nowhere to be found, as far as I can tell. I found several "Event" menus, but none of them seem to refer to the button being pressed. Searched online, only got more and more frustrated.
So...help please? lol
[Solved] Add actions for command buttons
[Solved] Add actions for command buttons
Last edited by MrProgrammer on Mon Sep 12, 2022 6:08 pm, edited 1 time in total.
Reason: Tagged ✓ [Solved] -- MrProgrammer, forum moderator
Reason: Tagged ✓ [Solved] -- MrProgrammer, forum moderator
OpenOffice 4.1.11 on Windows 10
Re: Command Button Actions
You can place the macro code into the actual document (then it will work in the actual document only); or you can place the code into a Module of the Standard library of the MyMacros (under the office software).Thing is, I know neither the code for these actions, nor (and more importantly) where to put the code.
Start with studiying Andrew Pitonyak's free macro books.
https://www.pitonyak.org/oo.php
Try to write your first code in the Basic IDE: Tools - Macros - Organize macros...
You can assign your macro code (subroutines) - located in the Modules - to the events of the control objects.I tried right-clicking and navigating all sorts of menus, but the "put the code for when you press the button" option is nowhere to be found, as far as I can tell. I found several "Event" menus, but none of them seem to refer to the button being pressed.
Here is a small sample file that contains a simple macro in the Module1, and it is assigned to an event of a Push Button:
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.