View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
GS GS is offline
external usenet poster
 
Posts: 364
Default Remove Excel addin completely

CB brought next idea :
Hello,

The sample code I found below uninstalls an Excel add-in but leaves it in the
list of available Add-ins.

Im looking for a script to "completely" remove the Excel addin (tidy is
nice!).

I need to do this across a range of users with Office 2003 & 2007 so I was
wanting to reference Excel objects rather than Registry Keys which vary
depending on the Office Version.

Does anyone know if there is code to "completely" remove an Add-in?
Kind Regards
Charlie.B

Dim oXL
Dim crAddin
on error resume next
Set oXL = CreateObject("Excel.Application")
for i = 1 to oXL.Addins.Count
Set crAddin = oXL.Addins.item(i)
If crAddin.Name = "xpaddin.xla" then
crAddin.Installed = False
End If
Next
oXL.Quit
Set oXL = Nothing


This is a complex process, but can be done. You'll need to write code
to remove the addin entries in the Registry. There are two keys that
must be edited: 'Add-in Manager' and 'Options'. You'll also need
several declares and constants for using the necessary RegistryAPI
functions, and two separate procedures to remove the Registry entries.
These two procedures will be called from a Main() sub that first checks
the Registry for each version of Excel that may be in use, to determine
if the addin has an entry. This is necessary because each Excel version
has its own Registry key, and you must edit the correct key. Thus, you
may have to check several keys depending on the earliest version of
Excel the addin has been installed to.

If you're not up for messing around in the Registry, post the filename
of your addin and your email address if you want me to send you a
VB6.exe that will do this for you.

Garry