Professionally remove Excel Add-Ins

The Problem

After uninstalling an application that contains a per user based Excel Add-In (.xlam or .xla), you should start Excel to double-check if an warning message like this appears:

The Reason

Excel installs and registers all automation Add-Ins by default in a per user based location, if they are installed via a script or the Excel GUI.

During uninstall process of an application that has installed such an Excel Add-In the process can only uninstall the registration information of this Add-In in the user context that executes the uninstall process. That means if the application has been used by different users, there will be the registration part left in the other user profiles. Excel will try to load the Excel Add-In, even if the file it self has been removed and this will prompt the warning message.

The Solution

Remove the Excel Add-In registration information from all user profiles. This can be done by using Microsoft Active Setup as the the script we use needs to be executed on each user that operates on the workstation.

This is the location where the Excel Add-In registration information will be stored


The Script

The script is a VBScript.

It needs the full path to the Add-In as an argument.

Example: RemoveExcelAddin.vbs “C:\Hyperion\SmartView\Bin\HsTbar.xla”

This is the source code of the script:

Dim oXL, oAddin
Set oXL = CreateObject(“Excel.Application”)
strPath = WScript.Arguments.Item(0)
Set oAddin = oXL.AddIns.Add(strPath, False)
oAddin.Installed = False
Set oAddin = Nothing
Set oXL = Nothing

Implementation in the Package (32bit)

You need to add the file “RemoveExcelAddin.vbs” to a folder at your choice in the package. Exp. “C:\Windows\System32”.

The component which contains this file, must have the following settings:

You need to implement a Custom Action “New vbscript stored in custom action” to the package:Cust

The script will add an “Active Setup” to the computer when the product is uninstalling:

Set WshShell = CreateObject(“WScript.Shell”)
WshShell.RegWrite “HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\RemoveExcelAddon\”, “RemoveAddon”, “REG_SZ”
WshShell.RegWrite “HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\RemoveExcelAddon\StubPath”, “C:\Windows\System32\RemoveExcelAddin.vbs ” & Chr(34) & “C:\Hyperion\SmartView\Bin\HsTbar.xla” & Chr(34), “REG_SZ”

The Custom Action must have the following properties:

The 64bit Custom Action must have the following settings:


Post Navigation