VBA Code

Loading an Add-in Automatically

It is possible to distribute a PowerPoint add-in and to load the add-in automatically the next time a user opens PowerPoint.
If you are creating an installer for your add-in you need to add a registry key so the add-in will be loaded automatically.

HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\PowerPoint\AddIns\"Add-in Name" 

The "Path" will need to be the full folder path if the add-in has not been saved in the default folder.

Installing and Uninstalling an Add-in using code

The Add-ins collection contains all the add-ins that are available (and not just those that are installed).
You can refer to them explicitly using their name or by using a numerical index.

Addins("My Addin").Installed = False 
Addins("My Addin").Installed = True
Addins(1).Installed = False
Addins(1).Installed = True

Using the Open and Close Events

There are two other presentation events that are useful although unlike Excel these do not run automatically when a presentation is opened and closed.
These subroutines are again a good place to put initialisation and clean up code.

Private Sub Auto_Open() 
' Any initialisation code should be placed in here
End Sub

Private Sub Auto_Close()
' Any clean up code should be placed in here
End Sub

Addins Collection

With Application.AddIns(1) 
   .Registered = msoTrue
   .AutoLoad = msoTrue
   .Loaded = msoTrue

   .FullName =
   .Name =
   .Path =
End With

Using the Presentations Collection

The Presentations collection doesn't include open add-ins, which are a special kind of hidden presentation.
You can, however, return a single open add-in if you know the exact file name.


This will return the open add-in named "filename.ppa" as a Presentation object.
However, it is recommended that the AddIns collection be used to return open add-ins.

What Add-ins are Loaded ?

Sub ListAddins() 

    Dim oAddin As AddIn
    Dim oCOMAddin As COMAddIn
    Dim sAddins As String

    sAddins = "Standard Add-ins" & vbCrLf & "================" & vbCrLf
    For Each oAddin In Application.AddIns
        sAddins = sAddins & oAddin.Name & vbCrLf & vbTab & oAddin.FullName & vbCrLf
    Next oAddin

    sAddins = sAddins & vbCrLf & "COM Add-ins" & vbCrLf & "============" & vbCrLf
    For Each oCOMAddin In Application.COMAddIns
        sAddins = sAddins & oCOMAddin.ProgID & vbCrLf & vbTab & oCOMAddin.Description & vbcrlf
    Next oCOMAddin

    MsgBox sAddins

End Sub

PowerPoint 2000

When you load an Add-in using the (Tools > Add-ins) dialog box the add-in will not be loaded automatically the next time you open PowerPoint.
You can add the following VBA code to automatically registry the add-in which will force it to be loaded automatically.

Sub Auto_Open 
   With Addins(Addins.Count)
      .Registered = msoTrue
      .AutoLoad = msoTrue
      .Loaded = msoTrue
   End With
End Sub


  • You have to use the "Auto_Open" and "Auto_Close" events as there are no others.

© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited TopPrev