Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Visual Basic Timer
I need to run a certain code for 5 seconds. (i.e. a DC motor hooked @ a
certain speed). I assumed I would be able to use a "do while" loop and the =now(time) function but cannot seem to get it to work. Any tips? Thanks! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Visual Basic Timer
Try something like this.
Dim mytime As Date Dim mydelay As Single Dim myseconds As Integer myseconds = 5 If myseconds 0 Then mydelay = myseconds / 86400 Else Exit Sub End If mytime = Now() Do While Now() < mytime + mydelay DoEvents Loop -- Regards, Dave Patrick ....Please no email replies - reply in newsgroup. Microsoft Certified Professional Microsoft MVP [Windows] http://www.microsoft.com/protect "Jay" wrote: |I need to run a certain code for 5 seconds. (i.e. a DC motor hooked @ a | certain speed). I assumed I would be able to use a "do while" loop and the | =now(time) function but cannot seem to get it to work. Any tips? | Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Is Visual Basic the same as Visual Studio 2008? | Excel Worksheet Functions | |||
Can I run Visual Basic procedure using Excel Visual Basic editor? | Excel Programming | |||
changing the visual basic in office 2003 to visual studio net | Excel Discussion (Misc queries) | |||
Visual Basic HELP | Excel Programming |