Prevent from not responding in VBA

To prevent your program from not responding in VBA, add DoEvents to anywhere you might have a lot of data to process. This command could let txtStatus massages to be displayed normally. Otherwise, you will get the windows frozen and “not responding” while CPU keeps on busy since contents in txtStatus will not be refreshed!

Public Sub FileTester()
  Do While True
    '...
    DoEvents
    '...
  Loop
End Sub
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: