Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 06-17-2012, 04:38 AM
gmaxey gmaxey is offline Insert text at the end of a sentence Find/Replace Windows XP Insert text at the end of a sentence Find/Replace 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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert text at the end of a sentence Find/Replace Macro to find text and replace with form field containing that text iiiiifffff Word VBA 16 06-04-2016 01:47 AM
Insert text at the end of a sentence Find/Replace Bad view when using Find and Find & Replace - Word places found string on top line paulkaye Word 4 12-06-2011 11:05 PM
Insert text at the end of a sentence Find/Replace 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

Other Forums: Access Forums

All times are GMT -7. The time now is 02:15 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft