Share via


cells Property

Returns an IHTMLElementCollection object that represents a collection of cells in a specified table row or in an entire table.

expression.cells

*expression   * Required. An expression that returns one of the objects in the Applies To list.

Example

The following example inserts the specified text into each cell in the specified table.

Sub AddTextToTable(ByRef objTable As FPHTMLTable, ByRef strText As String)
    Dim intRow As Integer
    Dim intCell As Integer
    
    For intRow = 0 To objTable.rows.Length - 1
        For intCell = 0 To objTable.rows _
                .Item(intRow).cells.Length - 1
            objTable.rows.Item(intRow).cells _
                .Item(intCell).innerText = strText
        Next
    Next
End Sub

Use the following example to call the preceding subroutine. This example assumes that you have at least one table in the active document.

Sub CallAddTextToTable()
    Call AddTextToTable(objTable:=ActiveDocument.all _
        .tags("Table").Item(0), strText:="Test")
End Sub

Applies to | FPHTMLTableRow Object | IHTMLTableRow Object