I have a powerpoint presentation that pulls multiple links from Excel. In order to update these links when the path changes I am using a macro I found online, but was hoping someone could help me with a couple of questions.
1. Should this macro take an excessive amount of time to run (sometimes over 5 minutes) - is there a way to speed it up?
2. I keep getting an error message "File is missing; cannot relink to a file that isn't present" however I have no way of identifying which slide or shape it is getting stuck on. Once I confirm the error it does continue on and run the rest of the macro to completion, but I would like to know which link is not updating and can't seem to find it. Is there a way?
Code:
Sub ChangeOLELinks()' Note: this will only work in PPT 2000 and later
Dim oSld As Slide
Dim oSh As Shape
Dim sOldPath As String
Dim sNewPath As String ' EDIT THIS TO REFLECT THE PATHS YOU WANT TO CHANGE
' Include just the portion of the path you want to change
' For example, to change links to reflect that files have moved from
' \\boss\p-drive\temp\*.* to
' \\boss\Q-drive\temp\*.*
sOldPath = "\\boss\p-drive\"
sNewPath = "\\boss\q-drive\"
On Error GoTo ErrorHandler
For Each oSld In ActivePresentation.Slides
For Each oSh In oSld.Shapes ' Change only linked OLE objects
If oSh.Type = msoLinkedOLEObject Then
On Error Resume Next ' Verify that file exists
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 ' shape
Next ' slide
MsgBox("Done!")NormalExit:
Exit SubErrorHandler: MsgBox("Error " & err.number & vbcrlf & err.description)
Resume NormalExit
2. I keep getting an error message "File is missing; cannot relink to a file that isn't present" however I have no way of identifying which slide or shape it is getting stuck on. Once I confirm the error it does continue on and run the rest of the macro to completion, but I would like to know which link is not updating and can't seem to find it. Is there a way?
Last edited: