ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   What can we use as an equivalent to "Sleep()" in vb? (https://www.excelbanter.com/excel-programming/402856-what-can-we-use-equivalent-sleep-vbulletin.html)

StargateFan[_3_]

What can we use as an equivalent to "Sleep()" in vb?
 
I searched through the archives and there were a few messages
discussing this but no actual syntax could be found (at least during 2
searches).

Is there any vb equivalent to "Sleep()"?

Thanks. :oD


RB Smissaert

What can we use as an equivalent to "Sleep()" in vb?
 
Use the Sleep API:

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

Sub TestingSleep()

Sleep 2000
Cells(1) = 1

End Sub


RBS

"StargateFan" wrote in message
...
I searched through the archives and there were a few messages
discussing this but no actual syntax could be found (at least during 2
searches).

Is there any vb equivalent to "Sleep()"?

Thanks. :oD



equiangular

What can we use as an equivalent to "Sleep()" in vb?
 
Do you mean this?

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

Sub test()
Msgbox "Wait for 1 sec"
Sleep 1000
Msgbox "Done"
End Sub

StargateFan wrote:
I searched through the archives and there were a few messages
discussing this but no actual syntax could be found (at least during 2
searches).

Is there any vb equivalent to "Sleep()"?

Thanks. :oD


Bob Phillips

What can we use as an equivalent to "Sleep()" in vb?
 
Two ways


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

Sub WaitSeconds()
Sleep 1000 * 3 ' 3 seconds
End Sub


and


Sub WaitFor()
Application.Wait Now + TimeSerial(0, 0, 3) ' 3 seconds
End Sub

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"StargateFan" wrote in message
...
I searched through the archives and there were a few messages
discussing this but no actual syntax could be found (at least during 2
searches).

Is there any vb equivalent to "Sleep()"?

Thanks. :oD




StargateFanFromWork[_4_]

What can we use as an equivalent to "Sleep()" in vb?
 

"Bob Phillips" wrote in message
...
Two ways


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

Sub WaitSeconds()
Sleep 1000 * 3 ' 3 seconds
End Sub


and


Sub WaitFor()
Application.Wait Now + TimeSerial(0, 0, 3) ' 3 seconds
End Sub


Thanks to everyone for their responses! :oD

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"StargateFan" wrote in message
...
I searched through the archives and there were a few messages
discussing this but no actual syntax could be found (at least during 2
searches).

Is there any vb equivalent to "Sleep()"?

Thanks. :oD







All times are GMT +1. The time now is 09:46 PM.

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