You've successfully subscribed to Nicholas Workshop
Great! Next, complete checkout for full access to Nicholas Workshop
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.

Prevent Not Responding in VBA

Nicholas Wong
Nicholas Wong

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  
Unsorted

Nicholas Wong

Fullstack software engineer with strong background in computer science and extensive experience in software engineering and architecture. Studied in NYU, worked in Yahoo, Rakuten and Manulife.