0
我有以下部分代码随着时间的推移而减慢执行速度。我的Word文档有超过200页,大约12000段。在第3000段左右,可以说执行速度比起始速度慢几倍。VBA - 字 - 遍历段落随着时间的推移变得难以置信
任何方式,我可以保持在同一水平上的速度?也许迭代通过段落是没有办法去所有的大文件?
Dim worddoc As Word.Document
Dim ParaCount as long, J as long, x as long
Dim RowData as string
With worddoc
ParaCount = .Paragraphs.Count
For J = 1 To ParaCount
RowData = .Paragraphs(J).Range.Text
x = x + 1
If x Mod 10 = 0 Then Application.StatusBar = x
Next ParaCount
End With
用于每个循环http://windowssecrets.com/forums/showthread.php/72208-Iterating-Word-objects-efficiently-(Word-VBA) – Slai
它的工作,速度是在同一个不错的水平为所有元素。请发布它作为答案。 –