Application.OnTime every Y sec with Y NON integer?

D

dexterslaboratory

Dear all,

my question is about the Application.OnTime Method.

Usually I use it after having these two variables defined:

Public RunWhen As Double
Public Const cRunIntervalSeconds = X

then the operation/procedure to be scheduled starts periodically when:

RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds)

Doing so, I can schedule my macros every X seconds where X is an
integer.

Now I wonder whether is possible scheduling event every Y seconds with
Y decimal (e.g.: 1.2 s, 4.5 s ...).

Any suggestion?

BR,
CR
 
J

JE McGimpsey

It's not possible using OnTime - the EarliestTime argument is rounded to
the nearest second.
 
B

Bob Phillips

You can do this with APIs if it is that important.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
D

dexterslaboratory

You can do this with APIs if it is that important.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

Bob,

thanks for your feedback.
I googled this matter with "APIs" as keyword and I have found this
interesting page from Chip Pearson's site:

http://www.cpearson.com/excel/OnTime.aspx

He suggests some procedures that work perfectly for my case.


BR,
CR
 
B

Bob Phillips

Yep, that is the sort of code that I meant.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top