Have you created or inherited a PowerPoint file that contains a linked video file that you want to share with others? Wouldn’t it be easier if you could send your recipients a PowerPoint file that contained all the videos as part of the file, rather than send them the linked videos separately?
That brings up a question, how easy is it to change the linked videos to become embedded?
All you need to do is run this LinkedMoviesToEmbeddedMovies VBA snippet, graciously coded by Steve Rindsberg of PowerPoint FAQ. Thanks to Steve for allowing us to reproduce this code here. Steve adds that it’s best that you do this only with a copy of your original file.
First, you need to know how you can run VBA scripts in PowerPoint. Then use this code. Explore the code a bit though since Steve has put in some helpful comments so that you can edit some values as required.
You can actually create a blank, new presentation and insert this code into the VBA editor. To learn how you bring up the VBA editor and add code, look at our VBA scripts in PowerPoint tutorial. Yes, it’s not necessary that this code is placed in the same presentation as your linked videos; all you need to do is make sure that both presentations (the presentation with this code, and the presentation with the video clips) are open at the same time.
Option Explicit Sub LinkedMoviesToEmbeddedMovies() ' Embeds linked movies/sounds ' Links must be intact or this won't work! ' NOTE: This also converts linked sounds Dim oSl As Slide Dim oSh As Shape Dim x As Long Dim sPath As String For Each oSl In ActivePresentation.Slides For x = oSl.Shapes.Count To 1 Step -1 Set oSh = oSl.Shapes(x) If oSh.Type = msoMedia Then If oSh.MediaFormat.IsLinked Then Debug.Print oSh.Name sPath = oSh.LinkFormat.SourceFullName Call ConvertToEmbedded(oSh, sPath) End If End If Next ' Shape Next ' Slide End Sub Sub ConvertToEmbedded(oSh As Shape, sPath As String) Dim oSl As Slide Dim oNewVid As Shape Dim x As Long Dim lZOrder As Long Set oSl = oSh.Parent lZOrder = oSh.ZOrderPosition Set oNewVid = oSl.Shapes.AddMediaObject2(sPath, msoFalse, msoTrue, _ oSh.Left, oSh.Top, oSh.Width, oSh.Height) Do Until oNewVid.ZOrderPosition = lZOrder oNewVid.ZOrder (msoSendBackward) Loop oSh.Delete End Sub Sub TestForLinkedMedia() Dim oSl As Slide Dim oSh As Shape Dim sTemp As String For Each oSl In ActivePresentation.Slides For Each oSh In oSl.Shapes With oSh If .Type = msoMedia Then If .MediaFormat.IsLinked Then sTemp = sTemp _ & "Slide: " & oSl.SlideIndex _ & vbCrLf _ & .LinkFormat.SourceFullName _ & vbCrLf End If End If End With Next Next If Len(sTemp) > 0 Then MsgBox sTemp Else MsgBox "No linked movies/sounds" End If End Sub
Once you have placed this code in the VBA editor, close the window to get back to your PowerPoint window. Before you proceed further, it’s a great idea to save your file. Ensure that you save it as a PowerPoint Macro-Enabled Presentation with the PPTM file extension. If you save as any of the other file formats, PowerPoint will offer to remove the macros, and then, of course, the code to change embedded videos to linked will not work! See our PowerPoint File Formats page to learn about these file formats.
Then open or switch to the presentation with the embedded videos and run the macro. To do that, press the Alt + F8 shortcut key. In the Macro dialog box that appears, next to Macro in: choose All open presentations, as shown in Figure 1, below. Click the LinkedMoviesToEmbeddedMovies Macro name, and then click the Run button, highlighted in red within Figure 1.
Figure 1: Run the LinkedMoviesToEmbeddedMovies Macro
Thank you so much, Steve.
We tested this code using PowerPoint 365 for Windows. Also, we have not checked this on PowerPoint 365 for Mac. If you do, and it does work or not, then we request you leave a comment below this post and share your thoughts. Of course, you should share your thoughts even if you are a Windows user.
When he’s not updating his site, he’s working on his popular PPTools add-ins for PowerPoint. Steve’s also into a lot of print technology related stuff.
You May Also Like: Use VBA in PowerPoint, Even if You Can’t Program for Nuts | Create Spirographs in PowerPoint Programmatically | Resources on PowerPoint Programming and VBA | VBA Code: Change Embedded Videos to Linked?