
Error trying to set relative path on linked powerpoint presentation
I use PPT2002. I wrote a small VB program to change links to linked
presentations from full path names to relative (no path). The presentation
and the linked presentations are in the same directory.
When I try to set the SourceFullName to a relative path I get a VB error as
such:
LinkFormat(Unknown Member): Failed
Works fine when I use the full path name. I tried "pres 1.ppt" and ".\pres
1.ppt". Should I be able to do this?
With srcPres
For slideCnt = 1 To .Slides.Count
Set srcSlide = .Slides(slideCnt)
With srcSlide
For shapeCnt = 1 To .Shapes.Count
Set currShape = .Shapes(shapeCnt)
With currShape
If .Type = msoLinkedOLEObject Then
linkPath = .LinkFormat.SourceFullName
pathComponents = Split(linkPath, "\", -1)
' ' The last element is the file name
---- Both of these fail -----
linkName = ".\" +
pathComponents(UBound(pathComponents))
' linkName =
pathComponents(UBound(pathComponents))
' ' reset to relative
.LinkFormat.SourceFullName = linkName
----- This works but defeats the purpose ----------
' .LinkFormat.SourceFullName =
"C:\myprojects\vbfixlinks\pres 1.ppt"
End If
End With
Next shapeCnt
End With ' srcSlide
Next slideCnt ' end for
End With ' end with srcPres
TIA