Site Search:
Sign in | Join | Help
4Penny.net

Steve Gray

Random Thoughts from the 4Penny VP of Development

How to get VBA to 'Sleep'

How do you get VBA to 'Sleep'? 

The Windows Sleep API call does exactly this. It puts your code to sleep and wakes it up after a specified time.

 

In the Declarations section of your module, include this:

 

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

 

Then in your Sub, use it like so:

 

Sleep 1000  ' to make your macro "sleep" for one second ( 1000 milliseconds )

Comments

No Comments

Leave a Comment

(required)  
(optional)
(required)  
Add

About Steve Gray

Steve is a seasoned (translate: old) developer in VB and ASP.NET. He spends most of his time in Dynamics GP, writing custom mods for consulting firms. Crystal reports, eConnect, VS Tools for Dynamics... anything that comes along.