Read all lines in document

R

Roger

Is it possible to loop through an entire word document on a line - by - line
basis?

If so, how?


Thanks,

Roger
 
G

Greg Maxey

If you have Word2003, you can try:

Sub IterateDocLines()

Dim pPage As Word.Page
Dim pLine As Word.Line

For Each pPage In ActiveWindow.ActivePane.Pages
For Each pLine In pPage.Rectangles(1).Lines
Debug.Print pLine.Range
Next
Next

End Sub
 
R

Roger

Thanks

Greg Maxey said:
If you have Word2003, you can try:

Sub IterateDocLines()

Dim pPage As Word.Page
Dim pLine As Word.Line

For Each pPage In ActiveWindow.ActivePane.Pages
For Each pLine In pPage.Rectangles(1).Lines
Debug.Print pLine.Range
Next
Next

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top