Note that the Initial Time and the displayed countdown are in cell M10; this can be changed to suit users preference, but note there are TWO points in the code to change:
Firstly the "m10" in line 5 and secondly, the "12,9" in line 22.
Code: Select all
Sub Countdown()
Doc = ThisComponent
Sheet = Doc.Sheets(0)
' ** Get Limit
strTime=Sheet.getCellRangeByName("m10").getString() ' the 1st change point to use a different cell
nTime=val(strTime)
nStartTime=Timer
nNewTime= nStartTime
Do Until nTime=0
Do while nStartTime=nNewTime
n NewTime=timer
Loop
nTime=nTime-1
nStartTime=nNewTime
Update
Loop
done ' you can get rid of this sub and put something more exciting in.
End Sub
Sub Update ()
Doc = ThisComponent
Sheet = Doc.Sheets(0)
Cell = Sheet.getCellByPosition( 12,9) ' the second change point
Cell.string=str(nTime)
End Sub
Sub done()
msgbox ("Out Of Time, Sorry",0,"Time UP")
End Sub