Edit Word Hyperlinks


A while back, my company moved a file server to a different server, and I needed to correct 6641 Microsoft Word documents in 36 subdirectories. The .doc files contained hyperlinks that referred to G:\documents, but the correct URL link was \\server1\documents. I needed to change the hyperlink to \\server2\companyfiles\documents. For example, to correct the full link \\server1\documents\path1\path2\path3\path4\info.doc, I needed to change only \\server1\documents. Thus, the new link would be \\server2\companyfiles\path1\path2\path3\path4\info.doc.

I wrote the VBScript script that Listing 1 shows to make the changes automatically. The script took only 28 minutes to run and saved me a lot of work. Start the script and enter a start path (e.g., \\server123\tempfiles\ or C:\tempfiles). Next, enter the old hyperlink reference (e.g., \\server1\documents). Then, enter the new hyperlink path (e.g., \\server2\companyfiles\documents).

The script will then open a .doc file from the start path, check for the old hyperlink reference, change the reference to the new hyperlink, save the file, close the file, and move to the next .doc file. The script will continue to loop until it checks and corrects each .doc file in the subdirectories.

Word 2000 has a glitch that prevents the script from running correctly. If a hyperlink has been changed manually before you run the script, the script can't detect the hyperlink and will generate a runtime error. The script works best with Microsoft Office XP. Even if Office XP changed a .doc file, you can still use an earlier version of Word to open the file.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.