Moving Links to Objects in Current Folder

K

Karl Kvool

I have been using a Word document since Office 97 that links to charts in
Excel documents that are contained in the same folder as the Word document.
Many times per day I will copy this folder and then paste in new Excel files
and open the Word document, and update the links. In Every version of
Office, Word would pick up the links from the Excel files in the current
document, even though if you chose NOT to update the links, you could see
they pointed to the original folder. But if you updated the links using the
prompt when opening the file, it would change them to the current folder.
Word 2007 inexplicably now refuses to look in the current folder, and keeps
the links pointed to the orginal folder. Oddly, Excel 2007 maintains the
"old" behavoir and looks in the current folder when updating links.

I have tried all of the suggestions I could find online, including this one
that was referenced in another post
(http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=670027), and also I
have tried using alt-F9 to view the field codes and upate them all using
Find/Replace. In Word 2007, when I "manually" re-point these links, I just
end up with an Error! Not a valid link. It appears there is more to links
than just the textual path that these examples expose.

I am desperately hoping there is a solution to this, or it looks like I'll
be running Word 2003 for a long, long time. If anyone has any ideas, I'd
appreciate the help.

Thanks!
 
K

Karl Kvool

Well, I poked around in the Word Object Model and thought I could write a
Macro that would point all linked objects to the current folder. The thing
works great except for one major flaw. The .Headers collection of the
ActiveDocument.Section(1) appears to be returning the **Footer** ? It tells
me its a header but I know for a fact its the footer because I put different
alt-text on the shape in the header and the footer. And the footer shape's
at text is what shows up every time. As of right know I need some serious
help accessing the shapes in the header. I can change all of the other
shapes in the document.

Here is the code for the macro which is attempting to change the header
shapes' .LinkSource.SourceFullName. I included the FixBodyLinks, which wil
take care of everything that is not in a header or footer.

Private Sub FixHeaderLinks()
Dim s As Shape
Dim sec As Section
Dim h As HeaderFooter
Dim NewPath as String
NewPath = ActiveDocument.Path)
With ActiveDocument
For Each sec In .Sections
For Each h In sec.Headers
If (h.IsHeader) Then
MsgBox ("I am a header")
Else
MsgBox ("I am NOT a header")
End If
For Each s In h.Shapes
MsgBox ("I am header shape " + s.Name + " and my alttext
is " + s.AlternativeText)
With s
If .Type = msoLinkedOLEObject Then
With .LinkFormat
.SourceFullName = Replace(.SourceFullName,
..SourcePath, NewPath)
.AutoUpdate = True
End With
End If
End With
Next s
Next h
Next sec
End With
End Sub

Private Sub FixBodyLinks(NewPath As String)
Dim s As Shape

For Each s In ActiveDocument.Shapes
With s
If .Type = msoLinkedOLEObject Then
With .LinkFormat
.SourceFullName = Replace(.SourceFullName, .SourcePath,
NewPath)
.AutoUpdate = True
End With
End If
End With
Next s
End Sub
 
K

Karl Kvool

Well, I ponied up my $250 to talk to someone at Microsoft who can help me
with this, and they acknowledged that it's an issue that was reported in late
November, and also that it is only Word 2007 that has this problem (not
Excel). However, the support person didn't give me a lot of confidence that
this will be fixed anytime soon, like its a low priority. I have to imagine
that as soon as some larger companies begin to dip their toes in the Office
2007 waters they are going to discover that when you copy a folder with
objects linked into word, you can forget about the links getting re-pointed
to the new folder. And then they are going to conclude, like I have, that
they're going to have to stick with Office 2003 for a while.
 

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