Code: Select all
Sub WriteFormattedDateTime()
Dim oSheet As Object
Dim oCell As Object
Dim sFormattedDate As String
oSheet = ThisComponent.Sheets.getByName("Sheet1")
oCell = oSheet.getCellByPosition(0, 0)
sFormattedDate = Format(Now(), "YYYY-MM-DD")
msgbox sFormattedDate
oCell.value = sFormattedDate
End Sub
Code: Select all
Sub WriteFormattedDateTime()
Dim oSheet As Object
Dim oCell As Object
Dim sFormattedDate As String
oSheet = ThisComponent.Sheets.getByName("Sheet1")
oCell = oSheet.getCellByPosition(0, 0)
sFormattedDate = Format(Now(), "YYYY-MM-DD")
msgbox sFormattedDate
oCell.string = sFormattedDate
End Sub