win32all-132 / Word Automation

Nikolai Kirsebom nikolai.kirsebom at siemens.no
Mon Jun 19 10:23:32 EDT 2000


I've installed win32all-132 (on python 1.5.2) and it seems to work
partially.  I've developped a small module I use to test a Word/VBA
project.  When I run my scripts now, it seems to fail in an area
related to the object model of document (Word 97).  The commands
listed below produces the enclosed error message.

-----------------------
Commands:
>>> import win32com.client
>>> apl = win32com.client.Dispatch("Word.Application")
>>> apl.Visible = 1
>>> doc = apl.Documents.Add()
>>> doc.Variables.Add(Name="abc", Value="def")
<win32com.gen_py.Microsoft Word 8.0 Object Library.Variable>
>>> print doc.Variables.Item(1).Name
-------------------------
Error Result:

Traceback (innermost last):
  File "<interactive input>", line 1, in ?
  File "D:\Python\win32com\client\__init__.py", line 347, in
__getattr__
    return apply(self._ApplyTypes_, args)
  File "D:\Python\win32com\client\__init__.py", line 341, in
_ApplyTypes_
    return self._get_good_object_(apply(self._oleobj_.InvokeTypes,
(dispid, 0, wFlags, retType, argTypes) + args), user, resultCLSID)
AttributeError: 'tuple' object has no attribute 'InvokeTypes'

----------------------------

Using the VBA debugger I'm able to inspect the variable - so it has
successfully been set.

Does anyone know what I'm missing.

Nikolai




More information about the Python-list mailing list