I was recently asked how to solve a "simple" problem.
A checkbox in a Calc document calls a macro when it is "clicked".
I want the macro to select a cell such that the cell is in input mode.
Ignoring the checkbox, I can use code similar to the following:
Sub CellSelectOne
Dim oCell
Dim oSheet
REM Get the first sheet.
oSheet = ThisComponent.getSheets().getByIndex(0)
REM Get cell A2
oCell = oSheet.GetCellbyPosition( 0, 1 )
REM Move the selection to cell A2
ThisComponent.CurrentController.Select(oCell)
Dim oFrame
Dim oDisp
oFrame = ThisComponent.CurrentController.Frame
oDisp = createUnoService("com.sun.star.frame.DispatchHelper")
oDisp.executeDispatch(oFrame, ".uno:SetInputMode", "", 0, Array())
End Sub
I even tried this:
Dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "ToPoint"
args2(0).Value = "$G$4"
oDisp.executeDispatch(oFrame, ".uno:GoToCell", "", 0, args2())
When the macro returns, the checkbox still has focus.
--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info: http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]