
Add row to the end of a table
In the code i use, i just say: oTable.Rows.Add
I dont' have any parenthesis after the function call.
Quote:
>-----Original Message-----
>Hi All,
>I'm having a problem adding a new row to the end of a
table (always the last
Quote:
>one) in my Word document. A snippet of the code I am
using is as follows:
Quote:
> With oWord
> Set oTable = .ActiveDocument.Tables
(.ActiveDocument.Tables.Count)
Quote:
> Set oRow = oTable.Rows.Add(oTable.Rows(1))
>When I run this code I get the error "Cannot access
individual rows in this
Quote:
>collection because the table has vertically merged
cells.", because there
Quote:
>are some cells merged together, although not the last row
(row 4) which is
>how I want the new row formatted
>I then tried adding a new table at the end of the
document, right underneath
Quote:
>the existing one, but this seems to join the two tables
together and when I
>try to set the width of a cell, it changes the widths of
the cells above!
>The code I use for this is below:
> With oWord
> Set oRange = .ActiveDocument.Range
> oRange.Collapse wdCollapseEnd
> Set oTable = .ActiveDocument.Tables.Add
(Range:=oRange, NumRows:=1,
Quote:
>NumColumns:=11)
>Does anyone know what I am doing wrong, or have another
idea about adding a
>row to the end of a table?
>TIA,
>Steve.
>.