/media/bill/HOWELL_BASE/System_maintenance/LibreOffice/macro_ToDos_Month_Count_update.txt www.BillHowell.ca ?dates? initial and updates LibreCalc macro for summing ToDos counts by day REM ***** BASIC ***** REM Macro to update sheet REM Menu -> Edit -> Links -> Update REM enddoc sub ToDos_Month_Count_update dim document as object dim dispatcher as object Dim iRow As Integer, iCol As Integer, i As Integer Dim oSheets, oSheet, oCells, oCell Dim oRow(), oRows() Dim oString As String oSheet = ThisComponent.Sheets.getByName("Month ToDo count") oCell = oSheet.getCellByPosition(10, 0) ' GetCell K1 document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") dispatcher.executeDispatch(document, ".uno:EditLinks", "", 0, Array()) rem nyet dispatcher.executeDispatch(document, "UC", "", 0, Array()) rem Neat - the following produces a MsgBox!! rem Print #0, "UC" rem Print #1, "UC" - doesn't work oString = "Latest update - Date: " & str(day(now())) & "-" & str(month(now())) & "-" & str(year(now())) & " Time: " & str(hour(now())) & ":" & str(minute(now())) oCell.string = oString rem oCells = oSheet.getCellRangeByName("A2:C5") REM getDataArray() returns the data as variant so strings REM are also returned. REM getData() returns data data as type Double, so only REM numbers are returned. REM oRows() = oCells.getData() REM For iRow = LBound(oRows()) To UBound(oRows()) REM oRow() = oRows(iRow) REM For iCol = LBound(oRow()) To UBound(oRow()) end sub enddoc