The attached document has a single table with two columns.
Selecting the entire table using Table > Select > Table, or all the rows starting with the second one (but not just the second one, and not rows 1 and 2 or rows 1-3) using Table > Select > Rows and suddenly, VBA can’t fetch the style of the selection.
The problem specifically happens when the end-of-row-markers are selected. Don’t select the EOR’s, and it works too. Selecting more than just the table, and there’s no problem either.
But select all (or that most I specified above) including the EORs, and Selection.Style returns error 91 (object or with variable not set).
Plenty of other tables work fine, but I’m finding this problem with a lot of tables in my documents. I need to make this work, because I have tools that operate on entire tables.
My usual trick of saving the doc out to XML and bringing it back into doc again doesn’t help either, so I’m not sure it’s a typical corruption.
The attachment is a .docx, but the .doc version of this file behaves the same way, and I can reproduce the problem in 2003 and 2007.
Any suggestions would be appreciated.
For instance, if there were a non-time-consuming way to detect if the whole table or whole rows were selected, I could back the end of the selection one character to the left, and deselect the row ends — then, there’s no problem.