Изменить формат ячеек, прежде чем ярлык является самым простым решением?
Формат ячейки после ярлыка не работает.
Макро способ ...
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