Log in

View Full Version : [SOLVED:] Delete Row[Run-time error 5991]



spak
08-01-2010, 10:49 PM
Hello,
i have table wich looks like this


+--------+--------------------------------------------+
| Text01 | Text02 |
+--------+---------+--------+--------+-------+--------+
| Text03 | Text04 | Text05 | Text06 | Text07| Text08 |
+--------+---------+--------+--------+-------+--------+
| Text09 | Text10 | Text11 | Text12 | Text13| Text14 |
+--------+---------+--------+--------+-------+--------+

and so on.

When i try to delete rows like this:

ThisDocument.Tables(1).Rows(6).Delete I get run-time error 5991: Cannot access individual rows in this collection because the table has verticaly merged cells.
I need to delete unused rows from the end of the table, because the number of rows varying from document to document.
I'm using Word 2003.

Thanks, for relplies

spak
08-02-2010, 12:59 AM
I found a solution if you need to delete row 6 you could do it like this:

ThisDocument.Tables(1).Cell(6, 1).Delete wdDeleteCellsEntireRow

fumei
08-03-2010, 02:28 PM
Thanks for posting your solution.