User defined functions through Automation in Excel 2003

Ian Parker parker at
Sun Sep 17 12:54:30 CEST 2006

In message <1157287011.801832.312350 at>, 
jpgreenwald <jpgreenwald at> writes
>Ive been looking more into this subject and now have a few things to
>add.  Im using some c# code that works in doing what I want (adds the
>function into excel):
>using System;
>using System.Runtime.InteropServices;
>namespace jtest {
>    [ClassInterface(ClassInterfaceType.AutoDual)]
>    public class test{
>        public test(){
>        }
>        public double Add2(double x, double y) {
>            return v1 + v2;
>        }
>    }
>I messed arround with it and without
>"[ClassInterface(ClassInterfaceType.AutoDual)]" the same thing happens
>that happened in python;  the dll would load but the function is not
>usuable.  So reading some more I was *thinking* that it was the early
>bound calls allowed by the AutoDual Interface that I cant seem to easy
>replicate in python.  Now I was *thinking* again that the only way to
>replicate that would be to use a typelib but I do not know how to
>generate that using a idl file I dont know how to create.  Again I was
>*thinking* that if I had a typelib I could use makepy and then gencache
>so when I use py2exe the typelib would be used and early bound calls
>would be used.
>Am I completely Insane and following a completely wrong thought process
>here?  If not, how do I make a idl file (then use midl.exe ?), and then
>make a tbl?  Thanks again for your thought.

Darn, I was interested in seeing an answer for this, although dismally 
unable to contribute myself.  Did I miss the responses?


Ian Parker

More information about the Python-list mailing list