MS Word COM error w/ Borders property

john whittaker john.whittaker at alliedsignal.com
Tue Nov 9 23:23:21 CET 1999


I got the following error when I tried to use get at the bottom border
from a borders collection:
>>> borders = word.ActiveDocument.Tables[0].Borders
>>>borders[ -3 ]
Traceback (innermost last):
  File "<interactive input>", line 1, in ?
  File "C:\Program
Files\Python\win32com\gen_py\00020905-0000-0000-C000-000000000046x1033x8x0.py",
line 2834, in __getitem__
    return self._enum_.__getitem__(index)
  File "C:\Program Files\Python\win32com\client\util.py", line 37, in
__getitem__
    return self.__GetIndex(index)
  File "C:\Program Files\Python\win32com\client\util.py", line 56, in
__GetIndex
    raise IndexError, "list index out of range"
IndexError: list index out of range

The -3 is the value of the wdBorderBottom constant in Word Basic.  The
"borders" object is a COM border collection.  I'm not currently up on my
Python syntax, but I think that a value of -3 for any list index is
invalid in Python.  If that's so, how can I get at this border object
from Python?





More information about the Python-list mailing list