Code:
Sub ActivateDoubleClickEventToActiveSheetAndChangeContentInCell
Dim Prop(1) As New com.sun.star.beans.PropertyValue
Prop(0).name = "EventType"
Prop(0).value = "Script"
Prop(1).name = "Script"
Prop(1).value = "vnd.sun.star.script:" & "Library1.Module1.ChangeContentInCell" & "?language=Basic&location=document"
ThisComponent.CurrentController.ActiveSheet.Events.replaceByName("OnDoubleClick", Prop())
End Sub
Sub ChangeContentInCell
Dim theSelection As Object : theSelection = ThisComponent.CurrentSelection
If NOT theSelection.SupportsService("com.sun.star.sheet.SheetCell") Then : Exit Sub : End If
With theSelection
If .String = "" Then : .String = "Hello" : Exit Sub : End If
If .String = "Hello" Then : .String = "Bye" : Exit Sub : End If
If .String = "Bye" Then : .String = "Hello" : Exit Sub : End If
End With
End Sub
After finish, the cell is in edit mode, the cursor is at the end of the cell content . How could I exit that edit mode ?