Page 1 of 1

[Solved] Change properties of Calc Push Button using macro

Posted: Wed Dec 06, 2023 5:18 pm
by Nocton
On sheet named 'Sheet1', I have a Push Button named 'Switch' with Label 'ON' and font colour green. After the button's action is executed I want to change it to 'OFF' and Red.
What is the best way to do that?

Re: Change properties of Calc Push Button using macro

Posted: Wed Dec 06, 2023 6:32 pm
by Zizi64
Here is a sample file with an embedded macro.
ButtonProperties.ods
(10.14 KiB) Downloaded 550 times
Modified sample: I just deleted two helper Print commands.

Re: Change properties of Calc Push Button using macro

Posted: Wed Dec 06, 2023 8:06 pm
by Nocton
Thank you Zizi64 - a nice solution.

Re: Change properties of Calc Push Button using macro

Posted: Thu Sep 04, 2025 2:01 pm
by qqaazz8
Zizi64 wrote: Wed Dec 06, 2023 6:32 pm Here is a sample file with an embedded macro.

ButtonProperties.ods

Modified sample: I just deleted two helper Print commands.
What is the code for "Additional information" ?

Re: Change properties of Calc Push Button using macro

Posted: Thu Sep 04, 2025 5:18 pm
by karolus
qqaazz8 wrote: Thu Sep 04, 2025 2:01 pm
What is the code for "Additional information" ?

Code: Select all

msgbox oButton.Tag

Re: [Solved] Change properties of Calc Push Button using macro

Posted: Thu Sep 04, 2025 7:38 pm
by Zizi64
Use one of excellent object inspection tools: MRI and XrayTool

Usage of them - inside the macro code - will list all existing properties and methods (and others) of the programming objects:

Code: Select all

xray oButton

mri oButton

Re: Change properties of Calc Push Button using macro

Posted: Thu Sep 04, 2025 10:06 pm
by qqaazz8
karolus wrote: Thu Sep 04, 2025 5:18 pm
qqaazz8 wrote: Thu Sep 04, 2025 2:01 pm
What is the code for "Additional information" ?

Code: Select all

msgbox oButton.Tag
Thanks.