MS Word COM error w/ Borders property

john whittaker john.whittaker at
Tue Nov 9 17:23:21 EST 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
line 2834, in __getitem__
    return self._enum_.__getitem__(index)
  File "C:\Program Files\Python\win32com\client\", line 37, in
    return self.__GetIndex(index)
  File "C:\Program Files\Python\win32com\client\", line 56, in
    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