Linked Word/Excel: Changing Excel Source File path

Greetings,  

I use a linked word/excel document with 140 or so linked places.  When I email the Word and Excel or move them to a new location, the links no longer work (of course).  The way I change it is hitting Alt-F9 then Find/Replace the file name for the old excel document with the file name for the new excel doc.

So the excel name when I hit Alt-F9 is something like: C:\\Users\\vm\\desktop\\template\\template.xlsx.  

Is there somewhere I can go that shows the source path for the Excel document that uses two backslashes like the above?  Currently, I right click on the Excel file, click Security, then copy the "Object name".  However, that only includes one backslash (i.e. it would be like the above with single backslashes: C:\Users\vm\desktop\template\template.xlsx), so then I have to add a second backslash when I paste to the find/replace box in my Word document.  A minor inconvenience, but I thought perhaps there is a way around it...

Thanks in advance!


Answer
Answer

See fellow MVP Macropod's article at:

http://windowssecrets.com/forums/showthread.php/154379-Word-Fields-and-Relative-Paths-to-External-Files

However, if that method does not work for you, you could use the following:

' 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,
Doug Robbins - MVP Office Apps & Services (Word)
dougrobbinsmvp@gmail.com
It's time to replace ‘Diversity, Equity & Inclusion’ with ‘Excellence, Opportunity & Civility’ - V Ramaswamy

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated March 27, 2024 Views 573 Applies to: