Alterar o formato das células antes que o atalho seja a solução mais simples?
Formatar célula após atalho não funciona.
Forma macro ...
Sub Main
Dim Doc As Object
Dim Sheet As Object
Dim Cell As Object
Dim NumberFormats As Object
Dim NumberFormatString As String
Dim NumberFormatId As Long
Dim LocalSettings As New com.sun.star.lang.Locale
Doc = ThisComponent
Sheet = Doc.Sheets(0)
Cell = Doc.getCurrentSelection
Column = Cell.CellAddress.Column
Row = Cell.CellAddress.Row
Cell.Value = Now()
LocalSettings.Language = "en"
LocalSettings.Country = "us"
NumberFormats = Doc.NumberFormats
NumberFormatString = "YYYY-MM-DD HH:MM:SS"
NumberFormatId = NumberFormats.queryKey(NumberFormatString, LocalSettings, True)
If NumberFormatId = -1 Then
NumberFormatId = NumberFormats.addNew(NumberFormatString, LocalSettings)
End If
MsgBox NumberFormatId
Cell.NumberFormat = NumberFormatId
End Sub