Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-14-2019, 04:40 AM
rosskemmett rosskemmett is offline MS word Macro to change the hyperlink base relative to where the file is located Windows 10 MS word Macro to change the hyperlink base relative to where the file is located Office 2019
Novice
MS word Macro to change the hyperlink base relative to where the file is located
 
Join Date: Oct 2019
Posts: 1
rosskemmett is on a distinguished road
Default MS word Macro to change the hyperlink base relative to where the file is located

I have a word document which includes 100's of hyperlinks to working files which have been created over a period of time.



I now want to copy the word file along with the associated documents on to a hard drive to be used by someone outside our network.

For example these files are located in S:/Workfiles/jobnumber/myfiles....

I would copy the folder "myfiles" on to a hard drive and the word file which contains the hyperlinks would sit just inside this folder.

All of the documents which the hyperlinks need to talk to would be located in a folder tree also inside "myfiles" folder.

I can easily do a find and replace on the hyperlinks so that they now point to the directory of the hard drive I'm using "D:/myfiles. This would work as long as who ever im giving the hard drive to uses it on the "D" drive.

However, Say someone plugs the hard drive in and its now in an "E:/" drive, the hyperlinks will now not work unless that person does their own find and replace (changing from D to E drive.


Is it possible to create a macro which sets the "Hyperlink Base" address to reference the drive where the file currently sits. I assume it would involve the "filename" field.


or

does anyone have any other suggestions on how to solve this issue another way.

Thanks

Ross
Reply With Quote
  #2  
Old 10-14-2019, 05:33 AM
Charles Kenyon Charles Kenyon is offline MS word Macro to change the hyperlink base relative to where the file is located Windows 10 MS word Macro to change the hyperlink base relative to where the file is located Office 2016
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Take a look at the sticky thread in this forum:
Word Fields and Relative Paths to External Files
You want to change the links which are in hyperlink fields to be relative to the location of the calling document.
Reply With Quote
Reply

Tags
hyperlink, macro, microsoft word 2016

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I use a Windows environmental variable as the value for the hyperlink base in Word emh7 Word 0 07-17-2019 10:08 AM
MS word Macro to change the hyperlink base relative to where the file is located Highlight sentences from a list located in another file Asuryan33 Word VBA 5 03-18-2019 05:09 AM
MS word Macro to change the hyperlink base relative to where the file is located macro to change part of the name of an existing Word file justinmo Word VBA 2 09-11-2018 06:08 PM
MS word Macro to change the hyperlink base relative to where the file is located How to create relative hyperlink in word2016 nofy Word 1 10-17-2016 01:08 AM
Error: The file may be corrupted, located on a server that is not responding, or read naeemeh Excel 2 11-20-2011 03:38 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:20 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft