Readdy Write  
0,00 €
Your View Money
Views: Count
Self 20% 0
Your Content 60% 0

Users by Links 0
u1*(Content+Views) 10% 0
Follow-Follower 0
s2*(Income) 5% 0

Count
Followers 0
Login Register as User

Word vba error: Can not address individual rows in this collection because the table contains vertically linked cells.

22.10.2018 (👁111)


 

 

System.Runtime.InteropServices.COMException

  HResult=0x800A1767

  Message=Es können keine individuellen Reihen in dieser Sammlung adressiert werden, weil die Tabelle vertikal verbundene Zellen enthält.

  Source=<Cannot evaluate the exception source>

  StackTrace:

<Cannot evaluate the exception stack trace>

 

 

 

The error occurs when you want to go through rows and columns in Word vba tables.

If cells have been linked horizontally or vertically in a table, enumeration after Table.Rows [n] or Table.Columns [n] is no longer possible

Here in C #

Because the table has linked cells, the program code causes an error in the Word add-in.

 

 

solution

Solution in vba or C # code.

One may only examine for Cells

cell = table.Cell(1, iCol);

If a cell can not be captured, try-catch must break the error

 

Example Word traversing through C # in a Word addin

//*Loop all tables and look for header

foreach (Word.Table table in _doc.Tables)

{

    if (table.Rows.Count > 0)

    {

        int intColumns_Count = table.Columns.Count;

        for (int iCol = 1; iCol <= intColumns_Count; iCol++)

        {

            //----< @Loop: Columns in Table_Header >----

            Cell cell = null;

            try

            {

                cell = table.Cell(1, iCol);

                if (cell.Range.Text.IndexOf(sHeader) == 0)

                {

                    return table;

                }

            }

            catch (Exception)

            {

                //< endofcolumns >

                break;

                //</ endofcolumns >

            }

            //----</ @Loop: Columns in Table_Header >----

        }

    }

}