ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   On Time Function (https://www.excelbanter.com/excel-programming/349660-time-function.html)

Bill[_30_]

On Time Function
 
Hello All,
I want to run a procedure every x minutes. To test this, I am using the
following:

Application.OnTime EarliestTime:=Now + TimeValue("00:00:10"),
procedu="SeeifTimeisPass"

Then I have a sub:

Sub SeeifTimeisPass
msgbox "Hi"
end sub

It runs through one time, but then does not reschedule to run again (running
every 10 seconds in this example). Any ideas why.

Thanks,.



Chip Pearson

On Time Function
 
OnTime only runs the code once. You have to reschedule the OnTime
method each time. See www.cpearson.com/excel/ontime.htm for
example code.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Bill" wrote in message
ink.net...
Hello All,
I want to run a procedure every x minutes. To test this, I am
using the following:

Application.OnTime EarliestTime:=Now + TimeValue("00:00:10"),
procedu="SeeifTimeisPass"

Then I have a sub:

Sub SeeifTimeisPass
msgbox "Hi"
end sub

It runs through one time, but then does not reschedule to run
again (running every 10 seconds in this example). Any ideas
why.

Thanks,.





All times are GMT +1. The time now is 12:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com