Link to home
Start Free TrialLog in
Avatar of lesterm
lesterm

asked on

Looping in Word VBA to the End of Document

I need to know how to write a loop that will execute until it reaches the End of the Document.  Something like the following: "Do while Not EOF".  If that is not possible I would like to know how to at least count the lines in the document?
Avatar of Brian Mulder
Brian Mulder
Flag of Netherlands image

Hi,

You can use the Word.wdWordDialog with the constant wdDialogToolsWordCount. This function will return your lines, paragraphs etc.
ASKER CERTIFIED SOLUTION
Avatar of frazer
frazer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lesterm
lesterm

ASKER

Thanks for the answer, but I was wanting to know how to count line by line or execute a command until the end of the file.  However, I do like the subroutine that you sent me.