macro to convert to relative paths for embedded objects

G

Guest

Hi,

I'd like to be able to convert all the paths in my ppt presentation to
relative links.
I found a KB article detailing how to do it for images.
http://support.microsoft.com/kb/827115
The code scans through all shapes in a ppt presentation, and finds any link
paths replaces them with just the filename.

I would like to modify the code to do the same for avi movies embedded via
Insert:Object:Browse for File. [It's a long story, but I _have_ to insert
the movies this way... Insert:Movies and Sounds will not work for me].

I'm pasting in the macro code below. I'm a VB newbie, but things I can
already identify that need to change are:

1. what method will return all such objects in a slide
For Each oShape In oSlide.Shapes

2. what the 'type' is for movies embedded, to tweak
If oShape.Type = msoLinkedPicture Then
[I tried both msoMedia and msoOLEObject, but neither worked on their own]

Cheers,
R

PPT 2003, WinXPsp2
 
G

Guest

Here's the code....

Sub RelPict()
Dim oSlide As Slide
Dim oShape As Shape
Dim lPos As Long
Dim strLink As String
'
' Loop through the presentation checking each shape
' on each slide to see if it is a linked picture.
'
For Each oSlide In ActivePresentation.Slides
For Each oShape In oSlide.Shapes
If oShape.Type = msoLinkedPicture Then
With oShape.LinkFormat
'
' Search from the right hand portion of the source
' file name and find the first backslash "\" character.
'
lPos = InStrRev(.SourceFullName, "\")
'
' Check to see if the link has already been modified.
'
If lPos <> Null Then
'
' Determine how long the file name is, by subtracting
' the position the "\" character was found at from
' the total length of the source file name.
'
lPos = Len(.SourceFullName) - lPos
'
' Extract the file name from the source file name, then
' assign the file name to the source file name, turning
' it into a relative path.
'
strLink = Right(.SourceFullName, lPos)
.SourceFullName = strLink
End If
End With
End If
Next oShape
Next oSlide
End Sub
 
S

Steve Rindsberg

Rustyconc said:
Hi,

I'd like to be able to convert all the paths in my ppt presentation to
relative links.
I found a KB article detailing how to do it for images.
http://support.microsoft.com/kb/827115
The code scans through all shapes in a ppt presentation, and finds any link
paths replaces them with just the filename.

This and several other useful features are part of the free demo version of our
FixLinks add-in. It also will collect the linked images and move them into the
same folder as the PPT if they're not there already.
http://www.pptools.com/fixlinks/
I would like to modify the code to do the same for avi movies embedded via
Insert:Object:Browse for File. [It's a long story, but I _have_ to insert
the movies this way... Insert:Movies and Sounds will not work for me].

OLE links like this don't allow relative paths or pathless links. It's got to
be the full absolute path or it won't work.

I'm pasting in the macro code below. I'm a VB newbie, but things I can
already identify that need to change are:

1. what method will return all such objects in a slide
For Each oShape In oSlide.Shapes

2. what the 'type' is for movies embedded, to tweak
If oShape.Type = msoLinkedPicture Then
[I tried both msoMedia and msoOLEObject, but neither worked on their own]

Cheers,
R

PPT 2003, WinXPsp2
 
G

Guest

OLE links like this don't allow relative paths or pathless links. It's got
to
be the full absolute path or it won't work.

Too bad... I guess I'll just have to face up to reinserting vids everytime I
present on a different computer.
Tx for info.
R
 
S

Steve Rindsberg

Rustyconc said:
Too bad... I guess I'll just have to face up to reinserting vids everytime I
present on a different computer.
Tx for info.

PowerPoint will look for some types of OLE content in the same folder as the
PPT itself; might want to give it a shot and see if that works with your vids.

Beats redoing all those links!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top