I was playing around with winim library. After seeing that it was damn well fully featured, I wanted to try to use it to make sure a COM AddIn loaded whenever I opened Excel. So I found this Loading addins when Excel is instantiated programmatically which is for AddIns and talks about setting
Excel.Application.AddIn(N).Installed = False
Excel.Application.AddIn(N).Installed = True
It's a neat answer, and I thought I could get it working with COM AddIn, but it doesnt work
import strutils
import winim/com
comScript:
var obj = CreateObject("Excel.Application")
obj.visible = true
obj.workbooks.add()
obj.displayalerts = false
var numAddIns:int = obj.COMAddIns.Count
# To be concise let's just pretend it has to be #2
if obj.COMAddIns(2).Connect == false:
obj.COMAddIns(2).Connect = true
See https://github.com/khchen/winim/blob/master/examples/com/Excel_Application2.nim
Unfortunately, this ain't working, it just throws an error. It's nice to be able to see if my program has loaded the COM AddIn , but if it hasn't I want to be able to programatically reload it