Im using two buttons and assigning a recorded macro to them, the only way i could get this to work was by assigning the same macro to both mouse down and mouse up events otherwise a double click was required.
I created two macros, ToggleOn and ToggleOff both are essentially the same code with just one edit, here is the code:
REM ***** BASIC *****
sub Main
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:SelectObject", "", 0, Array())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "ToPoint"
args2(0).Value = "$C$4"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "StringName"
args3(0).Value = "n"
dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args3())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:JumpToNextCell", "", 0, Array())
end sub
The change i referred to is just a “y” or “n”.
args3(0).Value = "n"
Can anybody tell me is there a better way to do this, Im not fussy about the form control, button check box or otherwise, i would just prefer to have only one form control that toggles the cell data if possible.