[python-win32] Excel automation

Peter Jessop pjessop at gmail.com
Wed Jun 15 14:55:50 CEST 2005


Running python 2.4.1 with pywin32-204 (2.4)
I am new to Python so this is probably an oversite on my part.
We are evaluating Python with the idea of replacing VBScript for
system administration.
I have been impressed with the capabilities of Python and in general
have found it easy to pick up.
Encountered the following problem with Excel.

>>> from win32com.client import Dispatch
>>> objExcel = Dispatch("Excel.Application")
>>> objExcel.Visible = 1
>>> objExcel.Workbooks.Add()
<win32com.gen_py.None.Workbook>
>>> objExcel.ActiveCell.Value="XXXXXXXXXX"
>>> objExcel.ActiveCell.Offset(1,0).Activate
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\Python24\lib\site-packages\win32com\gen_py\00020813-0000-0000-C000-00
0000000046x0x1x5.py", line 14615, in __call__
    , ColumnIndex)
  File "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line 446, in
 _ApplyTypes_
    return self._get_good_object_(
pywintypes.com_error: (-2147352567, 'Ocurri\xf3 una excepci\xf3n.', (0, None, No
ne, None, 0, -2146827284), None)

The problem occurs with both early and late binding.

Regards

Peter Jessop


More information about the Python-win32 mailing list