Declaring & Calling The Sleep API

浪尽此生 提交于 2019-11-29 13:55:38

The declaration of Sleep should go to the top of a module. Standard coding module.

You can omit Call and just use

Sleep 1000  ' 1 second delay

anywhere within an existing sub, so

Option Explicit

Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Sub Main()

    ' wait 3 seconds
    Sleep 3000

End Sub


an alternative without declaring the Sleep sub would be

Application.Wait Now + TimeValue("00:00:03") ' waits 3 seconds
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!