Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / December 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
StargateFan - 17 Dec 2007 12:56 GMT
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 - 17 Dec 2007 13:14 GMT
Use the Sleep API:

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

Sub TestingSleep()

   Sleep 2000
   Cells(1) = 1

End Sub

RBS

>I searched through the archives and there were a few messages
> discussing this but no actual syntax could be found (at least during 2
[quoted text clipped - 3 lines]
>
> Thanks.  :oD
Equiangular - 17 Dec 2007 13:17 GMT
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

> I searched through the archives and there were a few messages
> discussing this but no actual syntax could be found (at least during 2
[quoted text clipped - 3 lines]
>
> Thanks.  :oD
Bob Phillips - 17 Dec 2007 13:21 GMT
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

Signature

---
HTH

Bob

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

>I searched through the archives and there were a few messages
> discussing this but no actual syntax could be found (at least during 2
[quoted text clipped - 3 lines]
>
> Thanks.  :oD
StargateFanFromWork - 17 Dec 2007 18:04 GMT
> Two ways
>
[quoted text clipped - 9 lines]
>    Application.Wait Now + TimeSerial(0, 0, 3) ' 3 seconds
> End Sub

Thanks to everyone for their responses!  :oD

>>I searched through the archives and there were a few messages
>> discussing this but no actual syntax could be found (at least during 2
[quoted text clipped - 3 lines]
>>
>> Thanks.  :oD
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.