Find and Replace every occurrence with a bookmark hyperlink

Posted on 2014-08-19
Last Modified: 2014-08-20
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.
Question by:pdvsa
    LVL 47

    Expert Comment


    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


    Author Comment

    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

    Author Comment

    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
    LVL 47

    Expert Comment

    No I don't
    LVL 21

    Accepted Solution

    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.

    Author Comment

    Ok thank you.  I have been out of pocket the whole day.  Hope to test either in a few hours or tomorrow.  Thank you

    Author Closing Comment

    wow! that worked perfectly! thank you for the expert solution to this issue!!  Have a good night.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    When creating Microsoft Word-based forms there may be a need to have a form field repeated throughout the whole document. For instance, with a company name, you may want this information repeated automatically throughout the document rather than man…
    Shortcuts in Word Just the other day I had a training for Microsoft and they wanted me to show how well the new Windows and Office behaved on a touch device, which by the way is great, but it was only then that I realized that using keyboard shortc…
    This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
    This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now