jabroni
jabroni

Reputation: 13

Remove Add-in in Powerpoint with VBA

I have a VBA Add-in in PowerPoint that is updated occassionally. I wrote a code in VBA where every Monday there is a check wether a newer version of the Add-in exists. And if it does, PowerPoint automatically updates the Add-In. So far, I have this accomplished:

However, I can't seem to find the right command to delete the old Add-in in PowerPoint. The old Add-in is still in PowerPoint's available Add-ins, and PowerPoint also lists it under the inactive Application Add-ins.

Here's part of the Code that first deactivates the Add-in, and then tries to remove it from PowerPoint.

Dim oAddin As AddIn
For Each oAddin In Application.AddIns
   If Left(oAddin.name, 16) = "PPT ACO Add-in V" Then
       oAddin.Loaded = msoFalse
       Kill (oAddin) '<-- these is the line of Code that doesn't execute
   End if
Next oAddin

The program would work, but after some time I'd have a bunch of inactive Add-ins laying around in PowerPoint which will be very confusing to users.

Thank you so much for your help guys.

Tommy

Upvotes: 0

Views: 1162

Answers (1)

koriander
koriander

Reputation: 3258

very late answer, but since I passed by and I spent myself quite sometime on this issue, instead of

kill (oAddin)

you need

kill oAddin.fullname

although you should also remove the addin from the collection of AddIns and maybe unregister.

Also, in version 2010, you might get an error of permission denied when you try to delete the file. This is caused by ppt not releasing in time the open addin file. In fact, a timer does not solve it. But a second kill will actually work.

Upvotes: 2

Related Questions