Macro: Show MsgBox at specific time of the day

Hey everyone.

Max OS X Mojave 7.0.4.2

I have this macro from this the link
https://help.libreoffice.org/6.3/en-US/text/sbasic/shared/03130610.html?DbPAR=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

And I modified it as follows:

Sub ExampleWaitUntil_Test
Dim z As String
z = "Go to bed"
Dim vTimeschedule As Long
    vTimeSchedule = Date() + TimeValue("22:00:00")
    WaitUntil vTimeSchedule
    MsgBox z
End Sub

Basically, I want to show a message box with the phrase “Go to bed” in it at 22:00:00, so 10p.m.
Unfortunately, it doesn’t seem to work, and I’m not sure why.
Nothing happens, and the code keeps running.

I know the link is for LibreOffice 6.3, but I wanted to know if it would work anyway despite not being the same version of LO.

Hello

Dim vTimeschedule As Long

Long is an integer data type, this cuts (or rounds up to next day for Time >12:00:00) your time to integers and hence to full days at 00:00 (yes - LibreOffice Help is wrong here and this should be reported to Bugzilla)

Use:

Dim vTimeschedule As Double --or–
(deleted according to comment)

Tested using LibreOffice:

Version: 7.1.0.3 / LibreOffice Community, Build ID: f6099ecf3d29644b5008cc8f48f42f4a40986e4c
CPU threads: 8; OS: Linux 5.3; UI render: default; VCL: kf5, Locale: en-US (en_US.UTF-8); 
UI: en-US, Calc: threaded

Ref.: LibreOffice Help - Using Variables

Hope that helps.

Thanks! The whole code worked with vTimeschedule declared as Double, but no luck when declared as Single.
If declared as Single, either nothing happens or I receive the message “Action not supported.
Invalid procedure call.”, and WaitUntil vTimeSchedule is highlighted

@LibreOfficeDude

Your are right - it does not work for “Single” (why ever) - modified the answer to reflect your comment. Thanks …

Created bug report tdf#140118 Incorrect example in Help for BASIC function WaitUntil