Page 1 of 1

Automating Excel via COM/Python - standard addins won't load at startup

Posted: August 30th, 2010, 11:40 am
by newbie73
When I launch Excel through the Windows Explorer, a certain set of addins gets loaded as part of my user preferences. These addin preferences seem to be lost when I open an Excel instance via the PythonCOM interface. How can I launch Excel and enforce the addin loading process so that the same addins get loaded with a PythonCOM instance as with a non-automation instance?If it makes a difference, I am using the DispatchEx method from win32com:xl = DispatchEx("Excel.Application")

Automating Excel via COM/Python - standard addins won't load at startup

Posted: August 30th, 2010, 1:04 pm
by Hansi
When you instance-ize Excel from via the com interface you will generally need to load each add-in because they should be ignored in the instance object. I think there are a few examples about this on MSDN.

Automating Excel via COM/Python - standard addins won't load at startup

Posted: August 30th, 2010, 6:34 pm
by newbie73
Thanks for the heads up - I have been unable to find any reference to this on the MSDN forums. How can an addin be loaded programmatically with an Excel instance? I've tried a few things, including loading via a VBA function (works for some addins, does not work when loading ExcelDNA addins), also tried opening the addins manually as workbooks - this also failed. Any ideas on how to do this?

Automating Excel via COM/Python - standard addins won't load at startup

Posted: August 31st, 2010, 8:17 am
by MaxCohen
If you want to do this in VB then you use Createobject("WScript.Shell")e.g.http://www.tek-tips.com/viewthread.cfm? ... 5&page=484

Automating Excel via COM/Python - standard addins won't load at startup

Posted: August 31st, 2010, 5:35 pm
by Hansi

Automating Excel via COM/Python - standard addins won't load at startup

Posted: September 1st, 2010, 7:56 pm
by newbie73
Thanks for the replies - I was able to get around the problem by doing the following:1. Open the XLA / XLL file representing the addin in question2. Set addins(addin_name).Installed = False3. Addins(addin_name).Add(addin_file_path)4. Set addins(addin_name).Installed = True