等到Application.Calculate完成 [英] Wait until Application.Calculate has finished

查看:161
本文介绍了等到Application.Calculate完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

解决方案

进一步说我的意见,您可以使用DoEvents与 Application.CalculationState 。看到这个例子

  Application.Calculate 
如果不是Application.CalculationState = xlDone然后
DoEvents
结束如果
'~~>其余的代码。

如果你想要也可以使用 Do While Loop 检查 Application.CalculationState



我也建议看到这个链接



主题:Application.CalculationState属性



链接 http://msdn.microsoft.com/en-us/library /bb220901%28v=office.12%29.aspx



从上述链接引用


返回一个XlCalculationState常量,指示应用程序的计算状态,用于在Microsoft Excel中执行的任何计算。只读。



Can I force my vba script to wait until Application.Calculate has finished to recalculate all the formulas?

解决方案

Further to my comments, you can use DoEvents with the Application.CalculationState. See this example

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

I would also recommend see this link

Topic: Application.CalculationState Property

Link: 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.

这篇关于等到Application.Calculate完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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