vba 等到 Application.Calculate 完成
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11277034/
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
Wait until Application.Calculate has finished
提问by Sebastian Müller
Can I force my vba script to wait until Application.Calculate has finished to recalculate all the formulas?
我可以强制我的 vba 脚本等到 Application.Calculate 完成重新计算所有公式吗?
回答by Siddharth Rout
Further to my comments, you can use DoEvents with the Application.CalculationState
. See this example
除了我的评论之外,您还可以将 DoEvents 与Application.CalculationState
. 看这个例子
Application.Calculate
If Not Application.CalculationState = xlDone Then
DoEvents
End If
'~~> Rest of the code.
If you want you can also use a Do While Loop
to check for Application.CalculationState
如果你愿意,你也可以使用 aDo While Loop
来检查Application.CalculationState
I would also recommend see this link
我也建议看这个链接
Topic: Application.CalculationState Property
主题:Application.CalculationState 属性
Link: http://msdn.microsoft.com/en-us/library/bb220901%28v=office.12%29.aspx
链接:http: //msdn.microsoft.com/en-us/library/bb220901%28v=office.12%29.aspx
Quote From the Above Link
从上面的链接报价
Returns an XlCalculationState constant that indicates the calculation state of the application, for any calculations that are being performed in Microsoft Excel. Read-only.
对于在 Microsoft Excel 中执行的任何计算,返回一个 XlCalculationState 常量,该常量指示应用程序的计算状态。只读。