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

x
  • 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.
0
pdvsa
Asked:
pdvsa
  • 4
  • 2
1 Solution
 
Rgonzo1971Commented:
Hi,

pls try

Sub Macro1()

With Selection.Find
    .ClearFormatting
    .Text = "Schedule D Form of Disbursement Request"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Execute
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"
    Selection.Find.Execute

Loop

End Sub

Open in new window

Regards
0
 
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
0
 
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
0
[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.

 
Rgonzo1971Commented:
No I don't
0
 
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.
0
 
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
0
 
pdvsaAuthor Commented:
wow! that worked perfectly! thank you for the expert solution to this issue!!  Have a good night.
0

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