Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / General MS Word Questions / August 2004

Tip: Looking for answers? Try searching our database.

Changing Hyperlink Addresses

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul - 07 Aug 2004 07:09 GMT
When preparing Word documents for Intranet use, I set them
up in my C: drive
in a set of folders that match the folder structure on the
Intranet server.
Hyperlinks between documents are normally set up
as 'relative' links.

Digital copies of draft documents are sometimes passed to
others, may be
edited by them (but without touching the links) and then
re-saved locally
(usually under a new file name). When returned to me, I
put them back into
the original folder. At this point, the links should be as
they were
originally and be usable. In pre-XP days, this used to be
the case but I
have now found that, on at least a couple of occasions
since moving to full
use of XP, the links in the returned document have changed
to a path
structure incorporating folder names belonging to the
editor's PC. This
means that, to get the links usable again, they all have
to be re-edited to
eliminate the rogue elements in the path.

This is tiresome (and there is the risk that one or more
might get
overlooked) -- how can I stop it happening?
Doug Robbins - 08 Aug 2004 02:07 GMT
Hi Paul,

I don't know how you can stop it form happening, but this macro will
simplify the task of restoring them

' Macro created 26/10/01 by Doug Robbins to update links in a document
'
Dim alink As Field, linktype As Range, linkfile As Range
Dim linklocation As Range, i As Integer, j As Integer, linkcode As Range
Dim Message, Title, Default, Newfile
Dim counter As Integer

counter = 0
For Each alink In ActiveDocument.Fields
   If alink.Type = wdFieldLink Then

       Set linkcode = alink.Code
       i = InStr(linkcode, Chr(34))
       Set linktype = alink.Code
       linktype.End = linktype.Start + i
       j = InStr(Mid(linkcode, i + 1), Chr(34))
       Set linklocation = alink.Code
       linklocation.Start = linklocation.Start + i + j - 1
       If counter = 0 Then
           Set linkfile = alink.Code
           linkfile.End = linkfile.Start + i + j - 1
           linkfile.Start = linkfile.Start + i
           Message = "Enter the modified path and filename following this
Format " & linkfile
           Title = "Update Link"
           Default = linkfile
           Newfile = InputBox(Message, Title, Default)
       End If
       linkcode.Text = linktype & Newfile & linklocation
       counter = counter + 1
   End If
Next alink

Signature

Please respond to the Newsgroup for the benefit of others who may be
interested.   Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP

> When preparing Word documents for Intranet use, I set them
> up in my C: drive
[quoted text clipped - 26 lines]
> might get
> overlooked) -- how can I stop it happening?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.