慢Excel 2010宏执行 [英] Slow Excel 2010 Macro execution

查看:94
本文介绍了慢Excel 2010宏执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

以下测试marco在Excel 2007中需要1秒,在Excel 2010中需要5秒:

the following test marco takes 1 second in Excel 2007 and 5 seconds in Excel 2010:

Dim r1 As Range

Dim r2 As Range



设置r1 =范围("a1")

设置r2 =范围("a2")



i = 0

虽然我< 1000

    r1.Copy目的地:= r2

    i = i + 1

Wend



End Sub

Dim r1 As Range
Dim r2 As Range

Set r1 = Range("a1")
Set r2 = Range("a2")

i = 0
While i < 1000
    r1.Copy Destination:=r2
    i = i + 1
Wend

End Sub

自Office 2010以来,EXCEL发布了" WM_MSO_BROADCASTCHANGE "在每个range.copy(目标)操作上为所有顶级Windows。所有活动进程都会唤醒,查看消息并再次进入空闲状态。


Since Office 2010, EXCEL posts "WM_MSO_BROADCASTCHANGE" to all toplevel Windows on each range.copy(destination) action. All active processes wake up, peek the message and go idle again.

任何人都可以告诉我如何禁止oder禁用此消息吗?

Can anyone tell me how to suppress oder disable this messages?

谢谢

推荐答案

当你做什么时候这个:
$
Application.EnableEvents = False

What are the timings when you do this:
Application.EnableEvents = False

Excel是否停止播放该消息?

如果没有,我不确定是否您可以捕获它并通过Windows API函数取消它... WaitForSingleObject浮现在脑海中。

Does Excel stop broadcasting that message ?
If not, I'm not sure if you can trap it and cancel it via Windows API function...WaitForSingleObject comes to mind.


这篇关于慢Excel 2010宏执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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