0
votes

I have embedded links in many Microsoft Word documents that point to the wrong URL. These links all have specific titles like "Click Here" etc. So I need to fix the href URL and I want to do it through VBA. Basically I need to do a search and replace that looks at href URLs.

Example: Click Me needs to be change to Click Me

I know how to do a search and replace on text in a Word Document. What I can't figure out is how to update an href URL that isn't actually text on the page.

1
Word documents have a Hyperlinks collection - msdn.microsoft.com/en-us/library/office/ff192421.aspxTim Williams

1 Answers

0
votes
For Each link in ActiveDocument.Hyperlinks
    link.Address = Replace(link.Address, "yahoo", "google")
Next