[python-win32] Desire information about Invoke and InvokeTypes

Bob Gailer bgailer at alum.rpi.edu
Mon Apr 19 12:21:37 EDT 2004


I am debugging the com interface to Excel. This is a non-trivial post. If 
you can relate to this material and offer help, please do so.

Python program fragment:

sc = chart.SeriesCollection()
sc.Add(series_range, seriesAddDirection)

The last line causes an error. Here's the method code generated for Add by 
the dispatch module:

def Add(self, Source=pythoncom.Missing, Rowcol=2, 
SeriesLabels=pythoncom.Missing, CategoryLabels=pythoncom.Missing, 
Replace=pythoncom.Missing):
         ret = self._oleobj_.InvokeTypes(181, LCID, 1, (9, 0), ((12, 1), 
(3, 49), (12, 17), (12, 17), (12, 17)),Source, Rowcol, SeriesLabels, 
CategoryLabels, Replace)
         if ret is not None:
                 ret = Dispatch(ret, 'Add', 
'{0002086B-0000-0000-C000-000000000046}', UnicodeToString=0)
         return ret

The call to InvokeTypes returns integer 1 rather than a PyIDispatch object.

InvokeTypes is explained (tersely) at:

http://aspn.activestate.com/ASPN/docs/ActivePython/2.3/PyWin32/PyIDispatch__InvokeTypes_meth.html

but this is not enough information for me to understand why an integer is 
being returned.

I assume that InvokeTypes is part of the COM interface, and that Excel is 
responsible for handling it. Is this true? If so does this mean that there 
is a bug in Excel?

Bob Gailer
bgailer at alum.rpi.edu
303 442 2625 home
720 938 2625 cell 




More information about the Python-win32 mailing list