cellIndex Property

Microsoft FrontPage Visual Basic

cellIndex Property

Returns a Long that represents the position of the specified cell in a row.

expression.cellIndex

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

Example

The following example formats the background color of the third cell based on the position of the cell in the table.

Sub ChangeColorOfCell(ByRef objCell As FPHTMLTableCell)
    Select Case objCell.cellIndex
        Case 0
            objCell.bgColor = "red"
        Case 1
            objCell.bgColor = "blue"
        Case 2
            objCell.bgColor = "yellow"
        Case Else
            objCell.bgColor = "navy"
    End Select
End Sub
		

Use the following example to call the preceding subroutine.

Sub CallChangeColorOfCell()
    If ActiveDocument.activeElement.tagName = "td" Then
        Call ChangeColorOfCell(objCell:=ActiveDocument.activeElement)
    End If
End Sub