Thread: [Solved] Loop Until End of Document
View Single Post
 
Old 02-21-2021, 07:58 AM
Stephen Ray Stephen Ray is offline Windows 10 Office 2016
Advanced Beginner
 
Join Date: Sep 2018
Location: Kansas
Posts: 34
Stephen Ray is on a distinguished road
Default

Greg Maxey,
Yes, indeed, you may very well ask, "What is the point of that message box that tells you how many lines....."

I failed to mention, the msg box should be taken out, for actual use. But it sure was handy for developing and testing.

The point is not counting the lines, nor seeing the count.

The point is: Stopping the loop when the insertion point arrives on the last line of the document.

This Test returns = True - Only When the last Paragraph Mark in the document is highlighted.

I wrote this for myself to process a bulk of documents, assembled into one document, that were all similar except for a many variables like names and states; and where each document had to be re-arranged according to a certain formula. I needed some way to tell it to stop, end of document.
Reply With Quote