Nilesh’s Weblog

August 12, 2008

Sleep in VBA

Filed under: Microsoft Excel — Tags: , , — deshnilesh @ 11:08 am

Here’s another known trick for VB/VBA, if you code a lot in C/Java and then switch to VB/VBA you might be surprized to know that there is no sleep function in VB. However there is a hack to implement it.

Just refer the library kernal32 for Sleep function and then use it!! Simple isn’t it?

This is what you need to put in –

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

The function can be called as usual –

Sleep (2000)

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Create a free website or blog at

%d bloggers like this: