|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
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. |
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 |
Highlight sentences from a list located in another file | Asuryan33 | Word VBA | 5 | 03-18-2019 05:09 AM |
macro to change part of the name of an existing Word file | justinmo | Word VBA | 2 | 09-11-2018 06:08 PM |
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 |