ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pausing a VBA macro (https://www.excelbanter.com/excel-programming/273309-pausing-vba-macro.html)

Dean Taylor

Pausing a VBA macro
 
Is there any VB function (other than 'Wait') that allows
you to pause execution of a VB macro for a specified time?

The minimum pause allowable with the 'Wait' utility appears
to be 1 sec, but I only want to pause for a small fraction
of a second.

faustino Dina

Pausing a VBA macro
 
It should work. Copy the following line at the very beginning of your
module:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Then call in your subroutine:
Sleep(5000) ' for a delay of 5 seconds.

"Dean Taylor" wrote in message
...
Is there any VB function (other than 'Wait') that allows
you to pause execution of a VB macro for a specified time?

The minimum pause allowable with the 'Wait' utility appears
to be 1 sec, but I only want to pause for a small fraction
of a second.





All times are GMT +1. The time now is 08:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com