Serving the Quantitative Finance Community

 
User avatar
newbie73
Topic Author
Posts: 0
Joined: March 28th, 2007, 10:24 pm

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

August 30th, 2010, 11:40 am

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")
 
User avatar
Hansi
Posts: 41
Joined: January 25th, 2010, 11:47 am

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

August 30th, 2010, 1:04 pm

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.
 
User avatar
newbie73
Topic Author
Posts: 0
Joined: March 28th, 2007, 10:24 pm

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

August 30th, 2010, 6:34 pm

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?
 
User avatar
MaxCohen
Posts: 0
Joined: June 13th, 2007, 2:44 pm

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

August 31st, 2010, 8:17 am

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
 
User avatar
Hansi
Posts: 41
Joined: January 25th, 2010, 11:47 am

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

August 31st, 2010, 5:35 pm

 
User avatar
newbie73
Topic Author
Posts: 0
Joined: March 28th, 2007, 10:24 pm

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

September 1st, 2010, 7:56 pm

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