为什么VBA会说“(不响应)"?即使代码运行正常? [英] Why does VBA say "(Not Responding)" even when code is running fine?

查看:477
本文介绍了为什么VBA会说“(不响应)"?即使代码运行正常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在许多不同的VBA程序中遇到了这个问题,所以我想我在Excel或VBA编辑器中可能有一些不正确的设置.老实说,经过大量的网络搜索后,我还是一无所知.

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.

基本上,我将运行一段正常的代码,并且该应用程序(Excel和VBA编辑器)都将进入(无响应)模式. 但是代码运行良好.代码完成后,应用程序将不再处于非响应模式,一切恢复正常

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!

推荐答案

尝试将DoEvents语句放入代码中,以便在漫长的过程中经常执行DoEvents语句.请参阅 http://support.microsoft.com/kb/118468/en-us

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.

这篇关于为什么VBA会说“(不响应)"?即使代码运行正常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆