Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 03-23-2017, 10:06 PM
gmayor's Avatar
gmayor gmayor is offline Find word, Insert Paragraph and bookmark Windows 10 Find word, Insert Paragraph and bookmark Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The following should do the job
Code:
Sub macro2()
Dim myRange As Range
    Set myRange = ActiveDocument.Content
    With myRange.Find
        Do While .Execute(FindText:="Roll Call", MatchCase:=True) 'Find the text
            myRange.InsertParagraphAfter 'insert a paragraph break after it
            myRange.End = myRange.End + 1 'move the end of the range beyond the paragraph break
            myRange.Collapse 0 'Collapse the range to its end
            ActiveDocument.Bookmarks.Add Name:="mark", Range:=myRange 'add a bookmark at the range
            myRange.Select 'optionally select it
            Exit Do 'Stop looking for the text
        Loop
    End With
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find Bookmark, move to bookmark, execute code, repeat raymm3852 Word VBA 10 04-15-2016 06:21 PM
Find word, Insert Paragraph and bookmark Is there anyway I can insert an easy bookmark in word? BayhDole Word 2 07-21-2015 08:43 PM
Find last word in paragraph and delete it Dave T Word VBA 3 05-21-2015 12:40 AM
Find word, Insert Paragraph and bookmark Delete bookmark and paragraph which is blank dsjk9190 Word VBA 2 01-22-2015 01:15 AM
Find word, Insert Paragraph and bookmark [Word 2007] How to hyperlink directly another word file chapter/paragraph/bookmark? LeeFX Word 4 05-05-2011 05:53 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:55 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