After pressing the button, I need to change the focus to the first field.
This is my code:
Code: Select all
Sub CleanFields()
Dim Doc As Object
Dim Sheet As Object
Dim Cell As Object
Doc = ThisComponent
Sheet = Doc.Sheets.GetByName("Plan1")
Cell = Sheet.getCellRangeByName("D11")
If Msgbox("Do you want to clean all the fields?", 4 + 32 + 256) = 6 Then
Sheet.getCellRangeByName("D11").String = ""
Sheet.getCellRangeByName("D13").String = ""
Sheet.getCellRangeByName("D15").String = ""
Sheet.getCellRangeByName("D17").String = ""
Sheet.getCellRangeByName("D19").String = ""
Sheet.getCellRangeByName("D21").String = ""
Sheet.getCellRangeByName("D23").String = ""
Sheet.getCellRangeByName("D25").String = ""
ThisComponent.CurrentController.Select(Cell)
End If
End Sub
I don't want it to be selected. When the cell stays selected, the user can't change the focus to the next field pressing "TAB" or "ENTER".
How can I change the focus to the first field (Cell D11) without selecting it?
Thanks.