I'm trying to create a MSI installer that installs an Add-In (.xla) into Microsoft Excel (2007 in my case). Installing it goes well. I use a 'Custom Action' that runs this VBScript file:
Dim SourceDir
Dim objExcel
Dim objAddin
SourceDir = Session.Property("CustomActionData")
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Add
Set objAddin = objExcel.AddIns.Add(SourceDir & "addin.xla", True)
objAddin.Installed = True
objExcel.Quit
Set objExcel = Nothing
I pass the location of the addin to the script using the CustomActionData property. The Add-in is copied to a folder inside 'Program Files', where it will stay until it is uninstalled. This is handled by the installer itself.
The problem is when I use the uninstall script:
Dim objExcel
Dim addin
On Error Resume Next
Set objExcel = CreateObject("Excel.Application")
For i = 0 To objExcel.Addins.Count
Set objAddin= objExcel.Addins.item(i)
If objAddin.Name = "addin.xla" Then
objAddin.Installed = False
End If
Next
objExcel.Quit
Set objExcel = Nothing
The addin creates a custom toolbar in Excel u[ installation. The toolbar is not removed upon uninstall, and the entry of the add-in in the 'Add-in' section of Excel's settings isn't either.
Can anyone tell me if these two things can be done programmatically using VBScript?
thanks in advance