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

Steve Gray

Random Thoughts from the 4Penny VP of Development

July 2007 - Posts

  • 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 )