How to define a Word table with (horizontally) merged cells?

When a Word table contains horizontally joined cells, access to aTable.Columns.First or execution for each over aTable.Columns will result in an error.

Is there a way to determine if a table contains horizontally merged cells without causing an error?

I read Define that a Word cell is merged , but this is about determining whether a particular cell in a Word table is merged, and not the whole table, any merged cells.

+4
source share
2 answers

Found a link in this article to the Uniform property of the Table object, which will return false if the table merged or divided the cells,

Although this does not mean that the cells are horizontally or vertically combined (or both), but this is the beginning and the property answers my question.

+2
source

Yes it is there. Here is a logical explanation of how you find vertically merged cells. A horizontally merged cell can also detect, but this will require a bit more coding.

But, unfortunately, not by calling any WORD VBA method or accessing any property of cell or table. It by applying successive steps. Step1: -> Detect Row Count and Column Count of the table Step2: -> Declare an string array with same dimension as table( Dim A$()). Fill each cell of the array with "<m>" string. Step3: -> Start from cell(1) -> Then move cell by cell(Cell.Next method) -> Get each cells RowIndex and ColumnIndex. -> Erase the content "<m>" from the array, referenced by this RowIndex and ColumnIndex(A(RowIndex,ColumnIndex)="" -> Repeat this step until Cell.Next ends. Step4: -> Now check each cell of the Array(A$()). Those cells have the"<m>" string, are merged. Merged with immediate top cell. I've not placed any function or code block. Assume it'll be more easy. Thanks Shubhayan 
0
source

Source: https://habr.com/ru/post/1333257/


All Articles