Sleep command in ActiveX

  • Does anybody know of a command to sleep in ActiveX I have tried the WScript.sleep but how do you create the WScript object ?

    Regards

     

    Carl

  • Carl,

    Here is a example from the Microsoft VBScript site that uses the Timer function. With a little modification it might do the trick for you.

    The following example uses the Timer function to determine the time it takes to iterate a For...Next loop N times:

    Function TimeIt(N)   Dim StartTime, EndTime   StartTime = Timer   For I = 1 To N   Next   EndTime = Timer   TimeIt = EndTime - StartTimeEnd Function 
  • I use the following code:

    Dim sngFuture As Single

    sngFuture = Timer + 3

  • Somehow I didn't get the whole answer posted last time.  Here we go again:

    Dim sngFuture As Single

    sngFuture = Timer + 3   ' to sleep for 3 seconds

    Do Until Timer > sngFuture

    Loop

     

    Hope this helps.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply