poe*_*orn 2 execution-time word-vba
如何弄清我的VBA脚本执行所需的时间?我从PHP知道有一种类似microtime()的东西,它在脚本之前被调用一次,在脚本之后被调用一次,以便能够从该值计算出差值...
是否有等效的VBA?
这是我在一个VBA项目中使用的示例代码,用于临时评估脚本的性能。
您还可以找到足够的资源来优化脚本的性能
Public Sub generate(ByRef generators() As Generator)
Dim startTime As Double
OptimizePerformance doc
'/////////////////below is the line that matters
startTime = Timer
'////////// your code that is to be measured (in time) here //////////
MsgBox Format(Timer - startTime, "00.00") & " seconds"
removeOptimization doc
End Sub
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10534 次 |
| 最近记录: |