expression.insertCell(index)
expression Required. An expression that returns one of the objects in the Applies To list.
index Optional Long. The column number in the row at which to insert the new cell.
Remarks
When you use the insertCell method to create a new cell in a table, it inserts the cell into the specified row but does not insert an entire column. All cells in the row to the right of the new cell are pushed to the right to make room for the new cell.
Example
The following example inserts a new cell in the specified table at the specified row and column. Note that the code subtracts one from both the row number (intRow) and the position of the new cell (intCell). This is because all indexing in Microsoft FrontPage Visual Basic for Applications is zero based.
Function InsertNewCell(intRow As Integer, intCell As Integer, _
objTable As FPHTMLTable) As FPHTMLTableCell
Dim objCell As FPHTMLTableCell
Set objCell = objTable.rows(intRow - 1).insertCell(intCell - 1)
Set InsertNewCell = objCell
End Function
Use the following example to call the preceding function.
Sub CallInsertNewCell()
Dim objTable As FPHTMLTable
Dim objCell As FPHTMLTableCell
Set objTable = ActiveDocument.all.tags("table").Item(0)
If Not (objTable Is Nothing) Then
Set objCell = InsertNewCell(1, 3, objTable)
objCell.innerText = "Hello, World!"
Else
MsgBox "You dont' have a table in your document." & vbCrLf & _
"Add a table and run this code again."
End If
End Sub