Forum Discussion
qazzzlyt
Jul 21, 2024Brass Contributor
Fastest way to read entire Word text to array
ReDim arr(1 To wdDoc.Paragraphs.Count) For i = 1 To wdDoc.Paragraphs.Count arr(i) = wdDoc.Paragraphs(i).Range Next i I got above code to read all Word text to a array. It's very slow. What is ...
HansVogelaar
Jul 21, 2024MVP
Without looping:
arr = Split(wdDoc.Content, vbCr)
Keep in mind that
1) Split returns a zero-based array. The first paragraph is arr(0).
2) The elements of arr do not include the paragraph mark, unlike in your method.
qazzzlyt
Jul 24, 2024Brass Contributor
HansVogelaar thank you! This is exactly what I am looking for!