Hi!
I created a Microsoft Word document that contains dozens of linked objects
(OLE's). I am trying to change the path name in the "embedded objects"
within the Word. I want the macro to scan through each page in the document
and find each embedded object (which are linked to an excel file), then find
the pathname: "C:\drive\documents\file1.xls" and replace it with
"C:\drive\documents\file2.xls". I have the following as a beginnig point
but I could not finish it. This is my first attempt to write a VBA code. Any
help you could provide will be greatly appreciated. Here is my incomplete
code:
Sub ChangeSource()
Dim k As Long
'Create a variable to store the object reference string.
Dim strLink As String
With ActiveDocument
' Loop through all the floating shapes in document.
For k = 1 To .Shapes.Count
With .Shapes(k)
' If the shape's type is an OLE object then...
If .Type = msoLinkedOLEObject Then
' Change the path to new source and set the update
' type to Automatic.
With .LinkFormat
' Get the source path in a string
strLink = .SourceFullName
' Do something to strLink to modify:
'Code to modify strLink
.SourceFullName = strLink
.Update
End With
End If
End With
Next k
End With
Jean-Guy Marcil - 02 Aug 2007 06:04 GMT
Cevriye Kuntay was telling us:
Cevriye Kuntay nous racontait que :
> Hi!
> I created a Microsoft Word document that contains dozens of linked
[quoted text clipped - 36 lines]
>
> End With
Already answered in the vba.general group.

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org