Reputation: 87
I've run into this issue with many different VBA programs, so I'm thinking I may have some incorrect settings in Excel or the VBA editor. Honestly, I'm pretty clueless after a lot of web searching.
Basically, I'll be running a normal piece of code and the application (both Excel and the VBA Editor) will go into (Not Responding) mode. However the code is running fine. Once the code is finished, the application will no longer be in non-responsive mode and everything returns to normal
Really kinda frustrating on users who think something is wrong when really it's just taking a while to run the code.
Any help would be great! Thanks!
Upvotes: 3
Views: 13717
Reputation: 12027
Try putting DoEvents
statements in your code, so that DoEvents
is executed every so often during a lengthy process. See http://support.microsoft.com/kb/118468/en-us
This will return control to the OS, so that the OS can do what it needs to do while your program is running, and this should prevent the OS from thinking that your program is not responding.
Upvotes: 8
Reputation: 150148
Basically, I'll be running a normal piece of code and the application (both Excel and the VBA Editor) will go into (Not Responding) mode. However the code is running fine. Once the code is finished, the application will no longer be in non-responsive mode and everything returns to normal
The User Interface is not responding because you are doing a bunch of processing in response to a UI event.
If this is acceptable to you and your users, all's well enough. If not, consider doing the work on a background thread.
Upvotes: 0