Fixing relative and absolute links in Word, Microsoft Office 2013

This article explains how to replace absolute hyperlink references with relative ones, which makes your Microsoft Word document and linked files portable. So when you send them to a different computer, clicking on the hyperlink will open the file that you shipped with the Word document and not try to open the file that is on the computer where you wrote the document.

Say you are writing a final report for a survey and you have a link to the original contract, which is in a folder in the same directory as your report.You burn the Word document and the folder with the contract file on to a DVD and send it to out to the survey’s project manager. Then the project manager complains that the link doesn’t work. Instead of trying to open the file on the DVD, the link is trying to open the file that is on the computer that you wrote the Word report on.

We need to make sure that the links are ‘relative’, meaning relative to where the Word file is, not ‘absolute’, meaning where the original file was. In Office 2010 this was relatively straight forwards. With Office 2013 it is not.
 
To prevent this issue happening in the first place there is an option to set in Word, hidden under a sub menu of a sub menu:
 
  • Select “File > Options”
  • Select “Advanced”
  • Scroll down to “General” and select “Web Options”
  • Select the Files tab
This is great if you are in sole control of the document. But as soon as somebody else edits the file without this option being set correctly, you will inherit a Word file with hyperlinks pointing all over the place. Time to edit the underlying field codes.
The commands we are going to use are:
alt-f9 – this shows all of the hyperlinks as field codes. It toggles.
ctrl-f9 – click on a hyperlink and use this shortcut to toggle a single hyperlink to being the field code.
 
 A field code for a hyperlink will have curly brackets and the word HYPERLINK . For example, under your nice blue underlined link called ‘8.16 Water bottom Horizon’, using alt-f9 you might see something like:
 
{HYPERLINK “08_Supporting_Documents/8.16%20Waterbottom%20Horizon%20ASCII”}
 
This is a nicely formed relative hyperlink. However, if you start to see unpleasantness like:
 

{HYPERLINK “file:///\\\\v07-fnp\\Ship\\Projects\\03_Past_Surveys\\survey\\11_Reports\\04_End_of_Job\\FT_Processing_Report_v2\\Appendix\\13%20Post%20Processing%20after%20PreSTM\\Survey_Report_v1.pdf”}

You have an absolute link, which will try to open a file on v07-fnp\\Ship, which is unfortunate as this is a server on a survey ship. We need to use Word’s search and replace function to get rid of the bumf at the start.

Search on:

file:///\\\\v07-fnp\\Ship\\Projects\\03_Past_Surveys\\survey\\11_Reports\\04_End_of_Job\\FT_Processing_Report_v2\\

replace with

<intentionally left blank>

One more search and replace should be done. For whatever reason, we need to replace all ‘\\’ with ‘/’.

The information in this post should help you to get your links working correctly in your Microsoft Word documents in Office 2013. I am required to use Microsoft products at work. Life is simpler with Linux. But that is a topic for a different post.