Break links to objects in PowerPoint presentations

 2011-07-21    VBA programming    0    89

The procedure below can be used from Excel to break links to objects in a PowerPoint presentation:

Sub BreakLinksInPresentation(objPPT As PowerPoint.Presentation)
 Dim objSlide As PowerPoint.Slide, objShape As PowerPoint.Shape
     If objPPT Is Nothing Then Exit Sub
     
     For Each objSlide In objPPT.Slides
         Application.StatusBar = "Breaking Object Links in " & objPPT.Name & ", slide: " & objSlide.Name
         For Each objShape In objSlide.Shapes
             With objShape
                 If .Type = msoLinkedOLEObject Then
                     .LinkFormat.Update
                     .LinkFormat.BreakLink
                 End If
             End With
         Next objShape
         Set objShape = Nothing
     Next objSlide
     Set objSlide = Nothing
     Application.StatusBar = False
 End Sub
You can do the same thing inside PowerPoint by using the macro below:
Sub BreakLinksInActivePresentation()
 Dim objSlide As Slide, objShape As Shape
     For Each objSlide In ActivePresentation.Slides
         For Each objShape In objSlide.Shapes
             With objShape
                 If .Type = msoLinkedOLEObject Then
                     .LinkFormat.Update
                     .LinkFormat.BreakLink
                 End If
             End With
         Next objShape
         Set objShape = Nothing
     Next objSlide
     Set objSlide = Nothing
 End Sub
Both macros works in Office 2007 or later only.


Leave a comment:

Your comment will only be published after it has been moderated and found spam free.
Your e-mail address will only be used to display your Gravatar.