+ Reply to Thread
Results 1 to 4 of 4

Fraction of seconds

  1. #1
    ArthurJ
    Guest

    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. #2
    RB Smissaert
    Guest

    Re: 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" <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
    >
    >



  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    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...
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  4. #4
    ArthurJ
    Guest

    Thanks RBS & Leith (eom)



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1