I am writing a macro with trace precedents, and the beeps are not wanted.
Is there a way to stop the beeps within a macro?
I don't want to ask users of the macro to change their system settings (control panel, beep, or sound volume).
More specifically, is there a way to stop this dispatch from beeping?
oDispatcher.executeDispatch(oDoc, ".uno:ShowPrecedents", "", 0, Array())
I notice that LibreOffice Calc does not give beeps for this dispatch, but OpenOffice Calc does.
Thank you for any help.
[Solved] How to stop the beep from trace precedents, macro?
[Solved] How to stop the beep from trace precedents, macro?
Last edited by hcchan on Tue May 16, 2017 7:43 pm, edited 1 time in total.
OpenOffice 4.1 on Windows
Re: How to stop the beep from trace precedents with a macro?
The LibreOffice is not approproiate for you?I notice that LibreOffice Calc does not give beeps for this dispatch, but OpenOffice Calc does.
Can you upload your example ODF file together with the embedded macro code here?
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.
Re: How to stop the beep from trace precedents with a macro?
This macro shows the beep effects.
Sub test()
Dim oController As Variant
Dim oDocument as object
Dim oDispatcher As Object
oController = ThisComponent.CurrentController
oDocument = oController.Frame
oDispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
oDispatcher.executeDispatch(oDocument,".uno:ShowPrecedents", "", 0, Array())
End Sub
The macro works as expected, with the trace precedent arrows drawn properly.
It is just the beeps that I want to stop.
When an empty cell is selected, this macro beeps.
When a formula cell is selected, this macro beeps when there is no more precedent level to go.
BTW, I can use LibreOffice Calc, but I will like to use the macro in OpenOffice also.
Sub test()
Dim oController As Variant
Dim oDocument as object
Dim oDispatcher As Object
oController = ThisComponent.CurrentController
oDocument = oController.Frame
oDispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
oDispatcher.executeDispatch(oDocument,".uno:ShowPrecedents", "", 0, Array())
End Sub
The macro works as expected, with the trace precedent arrows drawn properly.
It is just the beeps that I want to stop.
When an empty cell is selected, this macro beeps.
When a formula cell is selected, this macro beeps when there is no more precedent level to go.
BTW, I can use LibreOffice Calc, but I will like to use the macro in OpenOffice also.
OpenOffice 4.1 on Windows
Re: How to stop the beep from trace precedents with a macro?
Try to call the API functions directly, instead of calling by the Dispatcher:When an empty cell is selected, this macro beeps.
Code: Select all
Sub test()
'Dim oController As Variant
'Dim oDocument as Object
Dim oSheet as Object
Dim oCell as Object
'Dim oDispatcher As Object
'oController = ThisComponent.CurrentController
'oDocument = oController.Frame
'oDispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
'oDispatcher.executeDispatch(oDocument,".uno:ShowPrecedents", "", 0, Array())
oSheet = ThisComponent.getCurrentController.ActiveSheet
oCell = ThisComponent.getCurrentSelection()
oSheet.showPrecedents(oCell.CellAddress)
End Sub
You can hide the Precedents by the
Code: Select all
oSheet.hidePrecedents(oCell.CellAddress)
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.
Re: How to stop the beep from trace precedents with a macro?
That works.
Thanks!
Thanks!
OpenOffice 4.1 on Windows