Word – How to format all hyperlinks in a Word document

formattinghyperlinkmicrosoft wordmicrosoft-officemicrosoft-word-2016

I have an MS Word document which has several links that don't show up as links. Hovering over the text shows the target URL, and if I right click to Edit Hyperlink, I can see the URL and the text shown for the hyperlink. However, the link boundaries are not visually apparent in the document.

I can use the Format painter to copy styling from a new and properly styled hyperlink to each one of these improperly formatted ones, but that will take a long time as there are many hyperlinks in my document and their edges are hard to find (this is the problem). How can I get ALL the links in my document to look like links?

Helpful info: when I click to place the cursor in one of these links and open the Styles pane (Alt+Ctrl+Shift+S or in the Home tab, click the arrow in the lower right corner of Styles), I can see their Style is Standard rather than Hyperlink.

Best Answer

With the document open, press Alt+F11 to get the Visual Basic editor window.
Choose Insert -> Module to get a blank code editor and paste in the following:

Sub ApplyHyperlinkStyleToAllLinksInDoc()
  For Each link In ActiveDocument.Hyperlinks
    link.Range.Style = ActiveDocument.Styles("Hyperlink")
End Sub

Then highlight this code and press Run (or F5).

As with any macro, you should probably save the document before running.

If you want to customize the hyperlink style for the whole document:

  1. Open the Styles pane as indicated in the question.
  2. Hover over Hyperlink so that a small drop-down arrow appears to the right of the word "Hyperlink."
  3. Click that dropdown and choose Modify, to get the Modify Style dialog.
  4. Change any desired options (color, underline, etc.). Some options are hiding in drop-down Format box in the lower-left corner which lets you set formatting options for Font (including small caps etc.), Border, etc.
  5. Choose OK, and the changes should apply to all links styled as Hyperlink, which if you ran the code above should be all links.

You can save the code module in Normal instead of the specific document and even assign a toolbar button or keyboard shortcut if you want to use it on a bunch of documents more quickly. You can also change the Style alterations in the Normal template if you want them to apply to new documents as well.