vba 此操作将取消挂起的刷新数据命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20278363/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
This action will cancel a pending refresh data command
提问by user2902589
While I am trying this code I am getting the error "This action will cancel a pending refresh data command.continue?"
当我尝试此代码时,我收到错误“此操作将取消挂起的刷新数据命令。继续?”
ActiveWorkbook.RefreshAll
Even if I put Application.Wait now() + TimeValue("00:01:20")
Excel is not refreshing properly.
即使我把Application.Wait now() + TimeValue("00:01:20")
Excel 没有正确刷新。
回答by LeonK
Solution: "Go to the data tab, click connections in the connections group, click on EVERY connection and click properties, un-check the box that says "enable background refresh"." ([email protected] , pcreview, 2013).
解决方案:“转到数据选项卡,单击连接组中的连接,单击每个连接并单击属性,取消选中“启用后台刷新”框。([email protected],pcreview,2013 年)。
This error may be caused by Excel being overloaded but only capable of reporting in this way. After trying all of the suggestions about 'DoEvents', 'WAIT'/SLEEP', 'FOR/NEXT' looping and opening each page to refresh singularly, I found, from PCReview website, that the solution is in the Data Connection properties and not VBA.
此错误可能是由于 Excel 过载而导致的,但只能以这种方式报告。在尝试了有关“DoEvents”、“WAIT”/SLEEP”、“FOR/NEXT”循环并打开每个页面以单独刷新的所有建议后,我从 PCReview 网站上发现该解决方案位于数据连接属性中,而不是VBA。
Once all background refresh connections have been disabled, the simple 'Activeworkbook.RefreshAll' command will suffice to update the entire workbook; mine was 29 pages large with 5 data connections and 7 SQL data connections.
一旦禁用了所有后台刷新连接,简单的“Activeworkbook.RefreshAll”命令就足以更新整个工作簿;我的有 29 页大,有 5 个数据连接和 7 个 SQL 数据连接。
NB: It was only the SQL data connections which allow the refresh to be disabled.
注意:只有 SQL 数据连接允许禁用刷新。
Hope that this helps with anyone having a headache over this issue as I did.
希望这对像我一样对这个问题感到头疼的人有所帮助。