How to close a PowerPoint add-in
Word and Excel provide a ThisDocument & ThisWorkbook object respectively, both of which return a reference to the document containing the running code. However, there is no ThisPresentation equivalent in PowerPoint.
For a standard PowerPoint presentation or template, the ActivePresentation object could be used, but this approach won't work for an PowerPoint add-in (tested in PP 2013). Loaded PP add-ins (.ppam) don't show up in the Presentations collection.
Here is a quick workaround solution:
For a standard PowerPoint presentation or template, the ActivePresentation object could be used, but this approach won't work for an PowerPoint add-in (tested in PP 2013). Loaded PP add-ins (.ppam) don't show up in the Presentations collection.
Here is a quick workaround solution:
Sub ClosePowerPointAddin Dim oAddin As AddIn Dim I As Long For Each oAddin In AddIns I = I + 1 If InStr(oAddin.Name, "MyTestAddin") > 0 Then AddIns.Remove I Next oAddin End Sub
How to update and break external links in PowerPoint Presentations
The code below will help you update and break all Excel links embedded in an active PowerPoint presentation.
Sub UpdateBreakLinks() Dim I As Long Dim S As Long On Error Resume Next With Application For I = 1 To .ActivePresentation.Slides.Count For S = 1 To .ActivePresentation.Slides(I).Shapes.Count .ActivePresentation.Slides(I).Shapes(S).LinkFormat.Update .ActivePresentation.Slides(I).Shapes(S).LinkFormat.BreakLink Next S Next I End With End Sub