Hello,
So I have my excel opening and running:
Private Sub Workbook_Open()
Call Start_Up
End Sub
In Start_up I have:
Sub Start_Up()
Dim x_minute As Integer
Dim y_minute As Integer
Dim wait_time As String
x_minute = Minute(Now())
If x_minute < 10 Then
y_minute = 10 - x_minute
wait_time = "00:0" & CStr(y_minute) & ":00"
Application.Wait (Now + TimeValue(wait_time))
Call Hourly_Work
Call Scheduler
Else
Call Hourly_Work
Call Scheduler
End If
End Sub
It will call the Hourly_Work and do the work just fine. The issue is what do I put in the Scheduler to have it run every hour but 10 minutes and 30 seconds after the hour? On the internet I can find several ways to do a loop every hour and that would be to place Application.OnTime Now + TimeValue("01:00:00"), "Hourly_Work" inside Hourly_Work at the end of it. The issue though is I need it to be 10 minutes 30 seconds after the hour that way the RTUs (Remote Transmitting Units) in the field have had time to communicate back to the database with the new values. Otherwise I am getting the previous hours values still. So if you have any suggestions and or help would be greatly appreciated, and thank you in advance.
So I have my excel opening and running:
Private Sub Workbook_Open()
Call Start_Up
End Sub
In Start_up I have:
Sub Start_Up()
Dim x_minute As Integer
Dim y_minute As Integer
Dim wait_time As String
x_minute = Minute(Now())
If x_minute < 10 Then
y_minute = 10 - x_minute
wait_time = "00:0" & CStr(y_minute) & ":00"
Application.Wait (Now + TimeValue(wait_time))
Call Hourly_Work
Call Scheduler
Else
Call Hourly_Work
Call Scheduler
End If
End Sub
It will call the Hourly_Work and do the work just fine. The issue is what do I put in the Scheduler to have it run every hour but 10 minutes and 30 seconds after the hour? On the internet I can find several ways to do a loop every hour and that would be to place Application.OnTime Now + TimeValue("01:00:00"), "Hourly_Work" inside Hourly_Work at the end of it. The issue though is I need it to be 10 minutes 30 seconds after the hour that way the RTUs (Remote Transmitting Units) in the field have had time to communicate back to the database with the new values. Otherwise I am getting the previous hours values still. So if you have any suggestions and or help would be greatly appreciated, and thank you in advance.