JeffGrant
Well-known Member
- Joined
- Apr 7, 2021
- Messages
- 558
- Office Version
- 365
- Platform
- Windows
Hi All,
I have this sub:
and I have this table:
The sub cycles through For Loop at column AI (Column Copy RaceID Time) and sets up all of the times for the day that the CycleThroughNextRaceMeetings sub needs to run.
On the whole the loops work fine.
However, everyday there is 1 or 2 race application.ontime calls that are simply missed. Today for example, the application.ontime for Ballarat Synthetic, Race 1, which was supposed to run at 12:43, simply did not run.
I understand that if other code is running or the workbook is in edit mode, that the application.ontime will not run. However, I have had many many attempts and changing delay time factors. or slowing things down or making sure that the workbook is not in edit mode, and is does not seem to make any difference.
I have spent hours on this and all I see on the WWW is the same information over and over.
I appreciate any guidance as to why members of this forum can suggest while the application.ontime scheduled times are missed.
thanks in advance
I have this sub:
VBA Code:
Sub RunAPIRaceTimer()
Dim TimeToRun As Date, LatestTimeToRun As Date
Dim strTimeToRun As String, strLatestTimeToRun As String
Dim lrow As Long
With Sheet10 'Todays Field List
irow = .Range("AI" & Rows.Count).End(xlUp).Row
For i = 2 To irow
TimeToRun = .Range("AI" & i).Value
'-------------------------------------------------------------------------------
'add 5 minutes to earliest time to run and see if this picks up the missing tracks
'-------------------------------------------------------------------------------
LatestTimeToRun = TimeToRun + TimeValue("00:05:00")
strTimeToRun = Format(TimeToRun, "hh:mm")
strLatestTimeToRun = Format(LatestTimeToRun, "hh:mm")
Application.OnTime strTimeToRun, "CycleThroughNextRaceMeetings", strLatestTimeToRun, True
Next i
End With
End Sub
and I have this table:
The sub cycles through For Loop at column AI (Column Copy RaceID Time) and sets up all of the times for the day that the CycleThroughNextRaceMeetings sub needs to run.
On the whole the loops work fine.
However, everyday there is 1 or 2 race application.ontime calls that are simply missed. Today for example, the application.ontime for Ballarat Synthetic, Race 1, which was supposed to run at 12:43, simply did not run.
I understand that if other code is running or the workbook is in edit mode, that the application.ontime will not run. However, I have had many many attempts and changing delay time factors. or slowing things down or making sure that the workbook is not in edit mode, and is does not seem to make any difference.
I have spent hours on this and all I see on the WWW is the same information over and over.
I appreciate any guidance as to why members of this forum can suggest while the application.ontime scheduled times are missed.
thanks in advance