Sub
ChangeOLELinks()
Dim
oSld
As
Slide
Dim
oSh
As
Shape
Dim
sOldPath
As
String
Dim
sNewPath
As
String
sOldPath = "C:\oldFolder\"
sNewPath = "C:\newFolder\"
On
Error
GoTo
ErrorHandler
For
Each
oSld
In
ActivePresentation.Slides
For
Each
oSh
In
oSld.Shapes
If
oSh.Type = msoLinkedOLEObject
Then
On
Error
Resume
Next
If
Len(Dir$(Replace(oSh.LinkFormat.SourceFullName, sOldPath, sNewPath))) > 0
Then
oSh.LinkFormat.SourceFullName = Replace(oSh.LinkFormat.SourceFullName, sOldPath, sNewPath)
Else
MsgBox(
"File is missing; cannot relink to a file that isn't present"
)
End
If
On
Error
GoTo
ErrorHandler
End
If
Next
Next
MsgBox(
"Done!"
)
NormalExit:
Exit
Sub
ErrorHandler:
MsgBox(
"Error "
& err.number & vbcrlf & err.description)
Resume
NormalExit
End
Sub