Prevent Not Responding in VBA

Prevent 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