The question posed on the Microsoft newsgroup was 'PowerPoint 2000
presentation has many links to audio and video files. Because of network
issues, we have had to move the linked files. Is there anyway to
quickly / programmatically update the links without having to manually
update each linked object?'
Related info: Download
Shyam's Toolbox with
links manager to fix link errors.
This example updates all the linked file paths to reflect the new
path.
|
Public Const
NewLinkPath = "C:\Documents and Settings\My Documents\"
Sub
UpdateToNewLinks() Dim I As Integer Dim J As Integer
' Create a variable to store
the file reference string. Dim LinkFileName As String
' Set a For loop to go from
slide 1 to the last slide in the presentation. For I
= 1 To ActivePresentation.Slides.Count
' Select the slide based on the
index value. With ActivePresentation.Slides(I)
' Loop through all the objects on
slide. For J = 1 To .Shapes.Count
' Use only shapes on the slide.
With .Shapes(J)
' If the shape's type is an OLE
object then... If .Type =
msoLinkedOLEObject Then
'
Ideally you should determine the type of OLE Object before working
on it. ' In this case I am assuming only wav/avi files have
been linked. ' Change the path to new source and set the update
type to Automatic. With .LinkFormat
' Now we shall extract the
filename from the complete path. ' ExtractFilename is a user
defined function written by me to ' extract only the filename
from a fully qualified path. ' Write your own "ExtractFileName"
function. I have not included the code for it ' In case you
have difficulty with it then get in touch with me.
LinkFileName = ExtractFilename(.SourceFullName)
' Concatinate the new Path
and filename and assign it to the ' SourceFullName property
.SourceFullName = NewLinkPath &
LinkFileName .AutoUpdate =
ppUpdateOptionAutomatic
End With
End If
End With Next
J End With Next I
' Update all links in the
presentation, so that the changes are ' visible and the source
file locations are correct on the screen.
ActivePresentation.UpdateLinks
End Sub |
|