Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General PowerPoint Questions / October 2006

Tip: Looking for answers? Try searching our database.

macro to convert to relative paths for embedded objects

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rustyconc - 05 Oct 2006 14:46 GMT
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
rustyconc - 05 Oct 2006 15:48 GMT
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
Steve Rindsberg - 05 Oct 2006 20:09 GMT
> Hi,
>
[quoted text clipped - 4 lines]
> 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:
[quoted text clipped - 10 lines]
>
> PPT 2003, WinXPsp2

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
rustyconc - 05 Oct 2006 20:36 GMT
> 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
Steve Rindsberg - 06 Oct 2006 04:27 GMT
> > OLE links like this don't allow relative paths or pathless links. It's got
> to
[quoted text clipped - 3 lines]
> 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!

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.