You all have given me great help throughout the years, including recently. This time, I want to share an answer rather than a question. I tried various methods for finding when I had reached the end of a document. Somehow, there were always hangups. Then I found a very simple method. I added an unlikely character, a close parenthesis “)”, to the end of my document, and then created a “Do Until” loop. Here is is my code. Enjoy!!
Public Sub Macro1() Selection.EndKey Unit:=wdStory Selection.TypeParagraph Selection.TypeText Text:=”)” Selection.HomeKey Unit:=wdStory Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend Do Until Selection.Text = “)” ‘ PUT YOUR CODE HERE FOR WHAT YOU WANT TO DO UNTIL YOU REACH THE END ‘ PUT CODE HERE TO MOVE TO THE NEXT PARAGRAPH. IF YOU ARE DELETING THINGS POSSIBLY, YOU MAY NOT NEED THIS UNLESS YOUR CONDITION IS NOT MET. ‘ ALSO, YOU MAY WANT TO PUT CODE IN TO TEST IF YOU ARE IN A TABLE ([CODE]If Selection.Information(wdWithInTable) Then
) AS THAT MAY AFFECT YOUR NAVIGATION THROUGH THE DOCUMENT.
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Loop
Selection.Paragraphs(1).Range.Delete
End Sub[/CODE]