Results 1 to 3 of 3

Thread: Help with Timer?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Posts
    118

    Post

    Hi
    I want a program to call a total of 8 commands. The commands need to be about 3 min apart.
    How would I do this. Thanks Paul

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    You can do something like this:

    Code:
    Private Sub TimeOut(pInterval As Single)
        Dim sngTimer As Single
        
        sngTimer = Timer
        Do While Timer < sngTimer + pInterval
            DoEvents
        Loop
    End Sub
    Then use this TimeOut routine to pause between your commands, i.e:


    Call Your Command
    TimeOut 180 ' In seconds thats 3 min
    Call Your Another command


    An so on...

    ------------------

    Serge

    Programmer Analyst
    [email protected]
    [email protected]
    ICQ#: 51055819


  3. #3
    Lively Member
    Join Date
    Jan 2000
    Location
    Springfield, IL
    Posts
    124

    Post

    This code will execute a DoWhile for the number of seconds that you set.
    Code:
        Dim dtTimer As Date
        Dim lngWaitSeconds As Long
        
        ' lngWaitSeconds  defines the length of time to run the loop
        lngWaitSeconds = 120
        dtTimer = Timer
        Do While (Timer - dtTimer) < lngWaitSeconds
        Loop
    Is this what you were looking for?

Posting Permissions

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



Click Here to Expand Forum to Full Width