|
楼主 |
发表于 2010-4-20 11:03
|
显示全部楼层
多线程,同时运行,突破VBA程序运行单线程限制
Sub ava()
Set x = CreateObject("scriptcontrol")
Set ie = CreateObject("htmlfile")
x.Language = "jscript"
x.EVAL "var bb;function aa() {bb.range('a1')+=1;} ;function mm(cc,dd){bb=cc;dd.setInterval(aa,2000)}"
y = x.Run("mm", ActiveSheet, ie.parentWindow)
x.EVAL "var bb;function aa() {bb.range('a2')+=1;} ;function mm(cc,dd){bb=cc;dd.setInterval(aa,2000)}"
y = x.Run("mm", ActiveSheet, ie.parentWindow)
For i = 1 To 888888888888888#
[a3] = [a3] + 1
DoEvents
Next
End Sub |
|