Implementing Sleep Function from VBA
Posted on 2005-04-07
I'm trying to implement the Sleep function from within a VBA module. It compiles without error, but at run-time, the execution hangs the first time the subroutine gets called.
Here's my code:
Private Declare Function vSleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
Const DelayTime = 20
Sub CommSleep(WaitMilliSec As Long)
If WaitMilliSec > 0 Then
... and to call the sleep function...
Any ideas what I'm doing wrong?