A
andrewhharmon
I have an word document with 84 inline linked objects from an excel
file. I need to be able to run a macro that will change the source file
of all the linked objects. My solution was as follows but has two
issues.
Sub test()
Dim i As Integer
With ThisDocument
For i = 0 To .InlineShapes.Count
If .InlineShapes(i).Type = 2 Then
.InlineShapes(i).LinkFormat.SourceFullName = "C:\test.xls"
End If
Next i
End With
End Sub
Issues:
1. If the object i linked to is an excel chart, it incorporates the
original excel file name in the item section of the linked object. (if
you go to edit...links... its the item column). Changing the source
name does not change the item section, so charts give an error.
2. Four of my linked items are in a header. I have no idea how to
access those objects. when i do a ?thisdocument.inlineshapes.count, in
the immediate window, it returns 80.... but i have 84 linked objects.
I also tried the above code using fields instead of inlineshapes.. no
luck. I'm using Word 2002 and excel 2003
Any help would be gretaly appreciated. Thanks
file. I need to be able to run a macro that will change the source file
of all the linked objects. My solution was as follows but has two
issues.
Sub test()
Dim i As Integer
With ThisDocument
For i = 0 To .InlineShapes.Count
If .InlineShapes(i).Type = 2 Then
.InlineShapes(i).LinkFormat.SourceFullName = "C:\test.xls"
End If
Next i
End With
End Sub
Issues:
1. If the object i linked to is an excel chart, it incorporates the
original excel file name in the item section of the linked object. (if
you go to edit...links... its the item column). Changing the source
name does not change the item section, so charts give an error.
2. Four of my linked items are in a header. I have no idea how to
access those objects. when i do a ?thisdocument.inlineshapes.count, in
the immediate window, it returns 80.... but i have 84 linked objects.
I also tried the above code using fields instead of inlineshapes.. no
luck. I'm using Word 2002 and excel 2003
Any help would be gretaly appreciated. Thanks