LibreOffice Help page https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03130610.html?DbPAR=BASIC contains the following Example for WaitUntil Statement (BASIC)
> REM Wait until 6:00 PM then call MyMacro.
> REM If after 6:00 PM, exit.
> Sub ExampleWaitUntil
> Dim vTimeschedule As Long
> vTimeSchedule = Date() + TimeValue("18:00:00")
> If vTimeSchedule < Now() Then Exit Sub
> WaitUntil vTimeSchedule
> Call MyMacro
> End Sub
This example does not work as intended, due to declaration "Dim vTimeschedule As Long", which is turning vTimeschedule into integer.
The documentation is incorrect here and requires "Dim vTimeschedule As Double" to demonstrate what is being intended.
Steps to Reproduce:
1. Open help page LibreOffice Help page https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03130610.html?DbPAR=BASIC
2. Implement the example given (with some adapted reasonable TimeValue) and (for testing purpose) replace the "Call Macro" by a MsgBox statement.
3. Start the makro
 You need to wait until midnight (case TimeValue > "12:00:00")
 Macro finishes immediately (case TimeValue < "12:00:00")
MsgBox appears at exact time give in TimeValue
Example in documentation needs to be changed to:
- Dim vTimeschedule As Long
+ Dim vTimeschedule As Double
User Profile Reset: No
See also question: https://ask.libreoffice.org/en/question/291019/macro-show-msgbox-at-specific-time-of-the-day/
Line 40 in https://opengrok.libreoffice.org/xref/help/source/text/sbasic/shared/03130610.xhp?r=b1aec63b
shows the correct entry.
<paragraph role="bascode" id="par_id3154367" localize="false">Dim vTimeschedule As Long</paragraph>
(In reply to Uwe Auer from comment #1)
> Line 40 in
> shows the correct entry.
> <paragraph role="bascode" id="par_id3154367" localize="false">Dim
> vTimeschedule As Long</paragraph>
correction: shows the **in**correct entry.
Thanks for the precise report, patch is on the way.
(if you want to challenge your skills and fix such mistake yourself, have a look at these instructions: https://wiki.documentfoundation.org/Documentation/GerritEditing )
Olivier Hallot committed a patch related to this issue.
It has been pushed to "master":
tdf#140118 Fix Help for BASIC function WaitUntil
Fixed in target 7.2.0 - https://help.libreoffice.org/7.2/en-US/text/sbasic/shared/03130610.html?DbPAR=BASIC