How do I change every Source File Links in Word 2000?

J

Joe3w

Is there a Word 2000 Visual Basic Macro that will change all othe the Source
File links all at once? When thare are many embedded links, it is very
cumbersum to change the Source File one link at a time.
 
C

Cindy Meister

Hmmm, not exactly, no...

Depending on what you're linking, and whether you've formatted it with text
wrapping, there would be a more streamlined method:

All links in Word are managed by field codes. You can see the field codes by
pressing Alt+F9 - as long as the linked objects aren't formatted with text
wrap. If all you need is "square" wrapping, it's usually sufficient to insert
the object into a FRAME (from the Forms toolbar).

IF the field codes are accessible: One possibility is to use Find/Replace on
the field codes to change the file path. Another is to substitute a
DocProperty field for the file path; create a custom document property to
hold the file path; all your code needs to do is change the value of the
property, then force the fields to update.
 
D

Doug Robbins - Word MVP

' 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


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top