[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 158
  • Last Modified:

Find and Replace every occurrence with a bookmark hyperlink

Hello, I have a large document with references to "Schedule D Form of Disbursement Request".  I want to replace each occurrence of this phrase with a hyperlink to the bookmark I made for "Schedule D Form of Disbursement Request" at the end of the document.  

How can I do that?   Let me know if you need additional explanation.
  • 4
  • 2
1 Solution

pls try

Sub Macro1()

With Selection.Find
    .Text = "Schedule D Form of Disbursement Request"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
End With

Do While Selection.Find.Found = True

    ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:="", _
        SubAddress:="Schedule D Form of Disbursement Request", ScreenTip:="", TextToDisplay:="Schedule D Form of Disbursement Request"


End Sub

Open in new window

pdvsaAuthor Commented:
Oh I see it is not something canned inside of Word.  I was hoping that there was.  I guess code is the only way.  Let me know if there is another way inside of Word.    thank you
pdvsaAuthor Commented:
how would I reference the bookmark that ties to the "Schedule D Form of Disbursement Request"?  I entered a bookmark that ties to the "Schedule D Form of Disbursement Request" and need to tie it to all of the hyperlinks.  Not sure if you follow me.  

thank you
[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

No I don't
Eric FletcherCommented:
You can do it without a macro.

Create the first instance of the hyperlink normally, then select it and copy it. Then, in the Find and Replace dialog, type Schedule D Form of Disbursement Request in the Find what box. In the Replace with box, type ^c (which is the token for Clipboard contents if you use the Special pulldown button). Replace All will change all instances of the phrase to the phrase set with the hyperlink.
pdvsaAuthor Commented:
Ok thank you.  I have been out of pocket the whole day.  Hope to test either in a few hours or tomorrow.  Thank you
pdvsaAuthor Commented:
wow! that worked perfectly! thank you for the expert solution to this issue!!  Have a good night.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now