Is it possible to run 2 macros from one event?
I have the below macro running from item status changed in my txtCustomer listbox. This updates my txtSimilarPart listbox.
I want a second macro to run from the same txtCustomer listbox for the same item status changed event which updates my txtReplaces listbox.
My Macros is
Sub CustChange
oForm1 = ThisComponent.Drawpage.Forms.getByName("MainForm") 'Get Form
oField = oForm1.getByName("txtCustomer")
sSelectedValue = oField.SelectedValue
sSql = "SELECT ""PartNumber"" FROM ""PartNumber"""&_
" WHERE ""CustomerID"" = '" & sSelectedValue & "' ORDER BY ""PartNumber"" ASC"
oField = oForm1.getByName("txtSimilarPart")
oField.listsource = array(sSql)
oField.refresh()
End Sub
For the second Macro I would just change to ("txtReplaces")
So can i create a macro for example Sub 2Macros that runs the two macros i need to run or do I build the two macros into one?
If i make the two macros into one is it as simple as just pasting in the second macro before the end of the End Sub?
many thanks
[Solved] Run 2 macros from one event?
[Solved] Run 2 macros from one event?
Last edited by Maax555 on Thu Jul 12, 2018 9:05 am, edited 1 time in total.
Regards Maax
LibreOffice 6.1.4.2 on Windows 7
LibreOffice 6.1.4.2 on Windows 7
Re: Run 2 macros from one event?
Run one macro ... which runs the two macros you want to run. They will be in sequence, not parallel.Maax555 wrote:Is it possible to run 2 macros from one event?
Showing that a problem has been solved helps others searching so, if your problem is now solved, please view your first post in this thread and click the Edit button (top right in the post) and add [Solved] in front of the subject.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Re: Run 2 macros from one event?
Hi John, thanks for quick reply. As I am not sure how to create the macro that runs the other two i tried the cut and past method. This actually worked to my surprise. However I would rather have them separate. Are you able to advise how to write the macro i need?
thanks again.
thanks again.
Regards Maax
LibreOffice 6.1.4.2 on Windows 7
LibreOffice 6.1.4.2 on Windows 7
Re: Run 2 macros from one event?
ok, so i tried this and it seems to work which worries me when i do something and it works first time.
Sub CustChangeSimRep
CustChangeSimilar
CustChangeReplaces
End Sub
is it really that simple?
Sub CustChangeSimRep
CustChangeSimilar
CustChangeReplaces
End Sub
is it really that simple?
Regards Maax
LibreOffice 6.1.4.2 on Windows 7
LibreOffice 6.1.4.2 on Windows 7
Re: Run 2 macros from one event?
Yes!Maax555 wrote:is it really that simple?
Alternatively, just paste the commands from macro_2 into macro_1 so you have one macro.
Showing that a problem has been solved helps others searching so, if your problem is now solved, please view your first post in this thread and click the Edit button (top right in the post) and add [Solved] in front of the subject.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.