I wish to create a reminder or an alarm to remind myself of reports due especially with irregular frequency.
Below is the code I wish to call automatically on a day and time I specify. It will pop up a message box and if No is clicked, it will ask again every 10 minutes until Yes is clicked.
ans = Msgbox("Have you submitted the report?",vbYesNo + vbQuestion, "Reminder")
If ans = vbNo then
Do Until ans = vbYes
WScript.Sleep 600000 'every 10 minutes, 1 = 1ms
ans = Msgbox("Have you submitted the report?",vbYesNo + vbQuestion, "Reminder")
Loop
End If
WScript.Quit
However, I don't know how to write code to trigger the script? Is there feature in VBScript similar to the event procedure in Excel VBA?
For example, I wish to have something like this:
If Weekday(Date()) = 3 or Weekday(Date()) = 5 And Time() >= TimeValue("3:30pm") then
'Call the above code
End If
However, the above if statement will not run itself even if the date and time are satisfied...
Additional questions:
If I clicked the No, the message box disappears and will come back in 10 minutes. What if I wish to exit the script before the next message box appears, how to realize this?
And also is there any way to specify the time unit rather than milliseconds for the Sleep method? Many thanks!