• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Kernel32 library function Sleep

Hi ,

You don't need to do anything other than make the correct declaration.
Code:
#If VBA7 Then
    Public Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) 'For 64 Bit Systems
#Else
    Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds as Long) 'For 32 Bit Systems
#End If

Sub SleepTest()
    MsgBox "Execution is started"
    Sleep 10000 'delay in milliseconds
    MsgBox "Execution Resumed"
End Sub
When you execute the SleepTest procedure , the system will freeze for 10 seconds between the two messages Execution is started and Execution Resumed.

Narayan
 
Last edited:
Back
Top