Re: Macro to change linked object source file
- From: "macropod" <invalid@xxxxxxxxxxxxxxx>
- Date: Wed, 1 Nov 2006 15:18:42 +1100
Hi Andrew,
If all you need to do is to change *all* the filenames to the same new
filename, then a quick & dirty change to the code I referred you to should
do it.
The code has a Function named 'ParseOldField()', with the line
'SourceFileName = OldField'. Change that line to 'SourceFileName =
"test.xls"', using whatever the real filename is, minus the path.
Cheers
--
macropod
[MVP - Microsoft Word]
<andrewhharmon@xxxxxxxxx> wrote in message
news:1162331378.400619.307790@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hey,file
Thanks for the help but that didn't seem to do it for me. That allowed
me to specify a folder which the links would be reset too. I need to
specify a new excel file name, more than likely in a folder with lots
of similar excel files. Anyway, it left all my links as invalid links.
Thanks anyway though.
-Andrew
macropod wrote:
Hi Andrew,
Check out the code in the document at:
http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=261488
It may do what you want.
Cheers
--
macropod
[MVP - Microsoft Word]
<andrewhharmon@xxxxxxxxx> wrote in message
news:1162323999.025692.178010@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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
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
.
- References:
- Macro to change linked object source file
- From: andrewhharmon
- Re: Macro to change linked object source file
- From: macropod
- Re: Macro to change linked object source file
- From: andrewhharmon
- Macro to change linked object source file
- Prev by Date: Re: Stripping Hard Returns
- Next by Date: Re: Macro to change linked object source file
- Previous by thread: Re: Macro to change linked object source file
- Next by thread: Re: Macro to change linked object source file
- Index(es):
Relevant Pages
|