Hi Andrew,

tried to reproduce the behaviour of your code.
The results were:
 With OOo 2.4 and 3.0 both on Linux. At first I could only change the
status of the checkbox if I turned the document to not editable and thus
could of course change nothing in cell A2.
But with the document set to editable and the form turned to Design Mode
off (from toolbar  Form Design) it worked  even without the dispatch call.

Hope that helps
Christoph
 

Andrew Douglas Pitonyak schrieb:
> 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.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to