Win32com, and Excel issues.

Ant antroy at gmail.com
Wed Apr 18 03:38:59 EDT 2007


Hi all,

I'm doing some Excel automation work for a friend, and am developing
on a machine running Office 2000. My friends machine is running Excel
2003. The code I've written works like a charm on my machine (in fact
all three of my machines), but falls over early on on Excel 2003.

The code snippet it falls over on is code to copy one worksheet after
another:

app = wincl.Dispatch("Excel.Application")
app.Visible = True
app.Workbooks.Open(self.filename)
sheet = app.Worksheets(1)
sheet.Copy(None, sheet)

and this last line throws the following exception:

pywintypes.com_error: (-2147417851, 'the server threw an exception.'
, None, None)

which isn't too helpful.

I'm wondering if something has changed in the Excel API that doesn't
allow a null parameter to Copy or some similar issue. I tried using
the keyword argument format, but that simply refused to work.

Other relevant information:

* The program is packaged using py2exe, so I know that the same
version of Python, and the same libraries are on each machine.
* One of the test machines running Excel 2000 does not have Python
installed.
* The machines are all of a similar spec.

Any ideas are welcome!




More information about the Python-list mailing list