Reputation: 2375
My Excel addin is written in C#, but the installer makes a call to Excel through a VBA macro. I want to get rid of VBA.
I wonder what the following VBA does to the registry. From what I see, it adds a value in HKCU\Software\Microsoft\Office\14.0\Excel\Options
. Is that it?
Dim MyXLL As AddIn
Set MyXLL = Application.AddIns.Add(addinFile)
If (Not MyXLL Is Nothing) Then
MyXLL.Installed = True
Else
MsgBox "Failed to add XLL"
End If
Upvotes: 0
Views: 248
Reputation: 23550
Using the Addins method from VBA or automation/interop is probably the easiest method but makes it difficult to handle the situation of more than one version of Excel installed on a PC.
A more comprehensive solution involves an install script writing OPENn keys (where n is 1 greater that highest current OPENn key) for each Excel version you want to install for, and reversing these actions in the uninstall script (you would also need to rewrite other OPENn keys that are higher than the OPENn key of your XLL).
You can find an example script using LUA for Setup Factory here http://www.jkp-ads.com/articles/AddinsAndSetupFactory.asp
Upvotes: 0
Reputation: 1615
You should try using excel interop from c#, instead of modifying the registry directly, which could lead to a nightmare (seriously). Also you would have to deal with different versions of office, etc.
Adding a addin via interop:
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.addins.add(v=office.11).aspx
Installing the addin after added:
Upvotes: 2