![]() |
|
#5
|
|||
|
|||
|
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 Last edited by macropod; 06-17-2012 at 04:48 AM. Reason: Added code tags & formatting |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Macro to find text and replace with form field containing that text
|
iiiiifffff | Word VBA | 16 | 06-04-2016 01:47 AM |
Bad view when using Find and Find & Replace - Word places found string on top line
|
paulkaye | Word | 4 | 12-06-2011 11:05 PM |
Help with find and replace or query and replace
|
shabbaranks | Excel | 4 | 03-19-2011 08:38 AM |
| Find and replace page numbers in body of text | tollanarama | Word | 3 | 02-13-2011 06:00 AM |
| Find & Replace Insert Issue | mipacker | Word | 0 | 02-18-2009 08:59 AM |