13 November 2018
I have found an [close enough]/[acceptable] answer from another learner from his/her post, and hence marked the topic as [Closed],
because it is not clicking a button in the other file to run the macro assigned to it.
Re: Run Macro in Another File
Postby Math » Tue Nov 13, 2018 12:48 pm
Many thanks to the friends who helped me,
I was able to find a solution on the following link:
https://ask.libreoffice.org/pt-br/quest ... -planilha/
hugs to all.
Original title
How to click a button in order to run a macro assigned to another button
In following another topic in this forum I have come across this topic, and the one who posted the question marked it as [Solved]
I copied and adapted the [solution – codes] and tried out the codes.
While I could clearly see that second button was being [pressed] by the macro assigned to the first button, the macro assigned to the second button, the one that had been [pressed] by the codes didn't run.
What went wrong?
Code: Select all
REM ***** BASIC *****
option explicit
sub testa
Dim oDoc As Object
Dim oSheet As Object
Dim oDP As Object
Dim oButton As Object
dim oPage as object
oDoc = ThisComponent
oSheet = oDoc.getSheets().getByIndex(0)
oDP = oSheet.getDrawPage()
oPage = oDp.getbyIndex(1)
oButton = oPage.getControl(1)
msgbox "oButton.name= " & oButton.name ''' oButton.name = btntestpushbtn (that is correct)
oButton.State = 1 ''' btntestpushbtn was seen pressed, but the assigned codes didn't run
Wait(500)
oButton.State = 0
oButton.reset()
end sub
sub testpushbtn
msgbox "This is filea.ods a LO_Calc workbook"
rem If this button was pressed on its own, the above msgbox would appear as expected.
end sub