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
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
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" <ArthurJ@discussions.microsoft.com> wrote in message
news:9F7E8D9E-F54D-4DE3-AC5F-8DDE60876A7C@microsoft.com...
>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
>
>
Hello Art,
You have 2 choices for more precision. The VBA Timer will provide you with accuracy to 1/100 of a second. The API timer will provide accuracy to 1/1,000 of a second.
The VBA Timer is easy yo use but has to be used in a loop. The API Timer is more a little more complex but can runs unattended in the background. I am going to skip posting the API Timer code due to its length. If you decide you need the API Timer, let me know in your next post and I will post the code separately.
VBA Timer example...
Sincerely,![]()
Please Login or Register to view this content.
Leith Ross
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks