View Single Post
 
Old 06-17-2012, 04:38 AM
gmaxey gmaxey is offline Windows XP Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,635
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

The problem with the sentence collection is that Word often can't determine what they really are.

Paul, try your code on:


<start level = "4"> Mr. Duck, a small rubber duck, went quack-quack.

AF, are these snippets of text really individual sentences nested in paragraphs or does each constitute a paragraph itself? If so, then this addaption to Pauls code may work:

Code:
Sub AddTags()
Dim oPar As Paragraph
Dim oRng As Word.Range
For Each oPar In ActiveDocument.Range.Paragraphs
 If InStr(oPar.Range.Text, "<start level = ""4""> ") = 1 Then
   Set oRng = oPar.Range
   oRng.Collapse wdCollapseEnd
   oRng.Text = "<end level = ""4""> "
 End If
Next
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/

Last edited by macropod; 06-17-2012 at 04:48 AM. Reason: Added code tags & formatting
Reply With Quote