View Single Post
  #6   Report Post  
Dennis
 
Posts: n/a
Default

Thanks Greg!

I was just going to ask about that issue.

Being a Word VBA novice, I will place the first three lines above the
loop and the remainder right before the Wend?

Dennis


Greg wrote:
Klaus,

If I can make a suggestions to dress the code up a bit. As is, if

the
user selects the final paragraph mark a continous loop occurs. I

added
the following lines to prevent this:

Dim i As Integer
i = Selection.StoryType
Set myRange = Selection.Range.Duplicate
If myRange.End = ActiveDocument.StoryRanges(i).End Then
myRange.MoveEnd wdCharacter, -1
End If