Modifying my previous code to include the code below does seem to imply that any reference to a collection of ProofReadingErrors does cause the collection to be rebuilt each time.
I am trying to treat yourErrors as an already built collection and retrieving the ranges that way.
But the time for that loop is almost identical to the time for the 2nd loop in which I explicitly ask for a single member of SpellingErrors each time. In this case, Word is very likely rebuilding the collection each time.
Also, you can see the same behavior for my code samples with much smaller documents, but the absolute time differences are not as large so the issue does not get noticed unless one is looking for this type of detail.
' yourErrors should now contain the collection of spelling errors.
QueryPerformanceCounter curQPStart
ReDim rngSpellingError(lngSpellingErrorCount - 1)
For i = 0 To lngSpellingErrorCount - 1
Set rngSpellingError(i) = yourErrors(i + 1)
Next i
QueryPerformanceCounter curQPEnd
lngTime = (curQPEnd - curQPStart) / dblQPFreq * 1000
Debug.Print "Copying ranges from collection: " & lngTime
QueryPerformanceCounter curQPStart
ReDim rngSpellingError(lngSpellingErrorCount - 1)
With ActiveDocument.Content
For i = 0 To lngSpellingErrorCount - 1
Set rngSpellingError(i) = .SpellingErrors(i + 1)
Next i
End With
QueryPerformanceCounter curQPEnd
lngTime = (curQPEnd - curQPStart) / dblQPFreq * 1000
Debug.Print "Using ActiveDocument.Content, Copying ranges from collection: " & lngTime