How do I Edit Hyperlink and Place in this Document for all Links

In MS Word 2010, I am editing a saved html file that has web hyperlinks to other parts of the same document.  I can manually edit the hyperlinks and "Place in this Document" for each link.  Is there way to do this for all the links in the document without having to edit each one individually?

Thanks

Maybe this old code will do it for you:

 

' Macro created 26/10/01 by Doug Robbins to update links in a document
'
Dim alink As Field, linktype As Range, linkfile As Range
Dim linklocation As Range, i As Integer, j As Integer, linkcode As Range
Dim Message, Title, Default, Newfile
Dim counter As Integer

counter = 0
For Each alink In ActiveDocument.Fields
    If alink.Type = wdFieldLink Then 

        Set linkcode = alink.Code
        i = InStr(linkcode, Chr(34))
        Set linktype = alink.Code
        linktype.End = linktype.Start + i
        j = InStr(Mid(linkcode, i + 1), Chr(34))
        Set linklocation = alink.Code
        linklocation.Start = linklocation.Start + i + j - 1
        If counter = 0 Then
            Set linkfile = alink.Code
            linkfile.End = linkfile.Start + i + j - 1
            linkfile.Start = linkfile.Start + i
            Message = "Enter the modified path and filename following this Format " & linkfile
            Title = "Update Link"
            Default = linkfile
            Newfile = InputBox(Message, Title, Default)
        End If
        linkcode.Text = linktype & Newfile & linklocation
        counter = counter + 1
    End If
Next alink

Hope this helps,
Doug Robbins - MVP Office Apps & Services (Word)
dougrobbinsmvp@gmail.com
It's time to replace ‘Diversity, Equity & Inclusion’ with ‘Excellence, Opportunity & Civility’ - V Ramaswamy

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated October 5, 2021 Views 203 Applies to: