1

I have a lot of powerpoint presentions with linked videos (stored in separate .wmv or .avi files which are located in the same path as the presentation itself).

For making the presentation "portable" (e. g. sharing them in MS SharePoint), I need to embed the videos to get one single file for each presentation.

I found a procedure which does that, it is described in the article: Optimize the media in your presentation for compatibility.

In general, you have to:

  • break the links
  • optimize for media compatibility
  • save the changes.

I would like to automate that process and do it in VBA for all open PowerPoint presentation files, but I could not find an example in the internet how to do it with VBA.

Which are the necessary commands for:

  • breaking all links in the presentation
  • optimizing media compatibility?
techraf
  • 4,902
p.m
  • 111
  • 2

1 Answers1

2

Try the follow code which resample every linked media in the open presentations.

Sub Embed()
Dim l As Slide
Dim s As Shape
Dim oDoc As Presentation

On Error Resume Next
For Each oDoc In Application.Presentations
    For Each l In oDoc.Slides
        For Each s In l.Shapes
            With s.MediaFormat
                If .IsLinked And s.MediaType = ppMediaTypeMovie Then
                    .Resample False, .SampleHeight, .SampleWidth, _
                             .VideoFrameRate, .AudioSamplingRate
                End If
            End With
        Next
    Next
oDoc.Save
Next
End Sub

For your first tests "Do not use this code on your original presentations"
This code is provided "AS IS" without warranties, I've tested on my presentations and it work fine.