win32com.client -- beginner question

Axel Schmitz-Tewes uzs59g at uni-bonn.de
Wed Jun 30 02:43:06 EDT 1999


Hello,

I ' ll try to use the comclient ability of python. In the Doku I have
found
the example:

o = win32com.client.Dispatch("Excel.Application")
o.Visible = 1
o.Workbooks.Add() # for office 97 – 95 a bit different!
o.Cells(1,1).Value = "Hello"

Because I have installed Excel95 I have given it a try and that's the
result:

Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import win32com.client
>>> o= win32com.client.Dispatch("Excel.Application")
>>> o.Workbooks.Add()
Traceback (innermost last):
  File "<stdin>", line 1, in ?
  File "E:\Programme\Python\win32com\client\dynamic.py", line 400, in
__getattr_
_
    raise AttributeError, "%s.%s" % (self._username_, attr)
AttributeError: Excel.Application.Workbooks

But Workbooks.Add is a available method as I can test with VBScript.
Is my installation corrupt or do I do some silly mistake or perhaps some
more serious?

Thanks for any answer.
Regards,
Axel






More information about the Python-list mailing list