Using Timer Control for Longer that 65 seconds
Using Timer Control for Longer that 65 seconds
There is a way to use only one Timer and have it fire off every hour or once a day, etc. Set up a text box for Date and one for Time, and then use this code:
‘ ==============================================
If Now > DateValue(txtDate.Text) + TimeValue(txtTime.Text) Then
‘ Do the function you need
cmdImportXML_Click
‘ PUT CODE HERE TO ADVANCE THE TIME OR DAY BY MINUTE(S), HOUR(S), DAY(S), ETC.
txtDate.Text = Format$(Date + 1, “mm/dd/yyyy”) ‘Advance the date by one day.
txtTime.Text = “23:00:00″
End If
‘ ==============================================
The Timer control’s Interval property is set for 60000 (60 seconds), and every 60 seconds it looks to see if the Date/Time criteria are met. If so, it fires off. Then the Date/Tme boxes are updated for the next interval.
BTW, DateValue and TimeValue are simple VBA functions.
Enjoy!