Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fraction of seconds
I have set up a timer as follows:
Dim alertTime alertTime = Now + TimeValue("00:00:01") Application.OnTime alertTime, "procedure" This does what I want, except I require time intervals less than one second. Is this possible? Art |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fraction of seconds
Simplest for if you just want a little wait is use the Sleep API.
Put this at the top of your normal module: Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) And use it like this: Sleep 300 'wait 300 milli-seconds procedure RBS "ArthurJ" wrote in message ... I have set up a timer as follows: Dim alertTime alertTime = Now + TimeValue("00:00:01") Application.OnTime alertTime, "procedure" This does what I want, except I require time intervals less than one second. Is this possible? Art |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fraction of seconds
Hello Art, You have 2 choices for more precision. The VBA Timer will provide yo with accuracy to 1/100 of a second. The API timer will provide accurac to 1/1,000 of a second. The VBA Timer is easy yo use but has to be used in a loop. The AP Timer is more a little more complex but can runs unattended in th background. I am going to skip posting the API Timer code due to it length. If you decide you need the API Timer, let me know in your nex post and I will post the code separately. VBA Timer example... Code ------------------- Sub TimeLoop() Delay = 0.02 StartTime = Timer Do While Timer < StartTime + Delay DoEvents 'Your code goes in here Loop End Sub ------------------- Sincerely, Leith Ros -- Leith Ros ----------------------------------------------------------------------- Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846 View this thread: http://www.excelforum.com/showthread.php?threadid=56184 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Thanks RBS & Leith (eom)
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Show fraction as fraction even if answer is 1 | Charts and Charting in Excel | |||
Text fraction to fraction format | Excel Worksheet Functions | |||
How do I change fraction to fraction characters? | Excel Worksheet Functions | |||
Converting Julian Seconds with a macro to replace old seconds data | Excel Discussion (Misc queries) | |||
Convert "Time Interval" in "hours : minutes : seconds" to seconds | New Users to Excel |