I have written this code to Display the time every 15 minutes using MSAgent:
(Private Sub Form_Load()
On Error Resume Next
Mytime = Time
Myhour = Hour(Mytime)
Myminute = Minute(Mytime)
Mysecond = Second(Mytime)
If Myminute = 15 And Mysecond = 0 Then Exit Do
If Myminute = 30 And Mysecond = 0 Then Exit Do
If Myminute = 45 And Mysecond = 0 Then Exit Do
If Myminute = 0 And Mysecond = 0 Then Exit Do
Debug.Print Myminute, Mysecond
theAgent.Speak "The time is " & Myhour & ":" & Myminute & "."
Do Until Mysecond > 0
Mysecond = Second(Time)
intCnt = 15000
start = Timer
waitTime = start + intCnt
Debug.Print Timer, waitTime, "start"
Do While Timer < waitTime
Debug.Print Timer, waitTime
The Code works. So far but it uses 50%cpu. Are there any ways of writing the timer delay routine to reduce the cpu usage. Sleep doesnt seem to be available in VB5
I'm a novice at writing code been away from coding for several years.
The OS in win XP and VB is version 5 with sp3.