Code to change the assigned macro of a button control on a sheet

I have created a push button on a sheet and have assigned it a macro to run when clicked. I can change the label of the button after it is clicked.

I am trying to use code to assign a different macro to it after it is clicked, but am having no luck. Any suggestions would be appreciated.

I am running LO 26.2.0.3 on Ubuntu 24.04.1 LTS.

Thanks in advance.

Just call different macros dependent on the current label.

If sLabel = "Step1" then
    macro1
ElseIf sLabel = "Step2" then
    macro2
If sLabel = "Step3" then
    macro3
End If

ask132167.odt (10.6 KB)

2 Likes

Thank you for your help, problem solved.

How to programmatically get/set a form control's events