Some experiments with Microsoft Word Tables and VBA

This code has been tested on Microsoft Word and Excel 2007. Some changes may be required for other versions.


Detect whether cells in a selected Microsoft Word table are empty
Sub IsCellEmpty()
    Dim Ocell As Cell
    Dim oRow As Row
    Dim RowIndex As Integer
    Dim ColumnIndex As Integer
    
    For Each oRow In Selection.Tables(1).Rows
        For Each Ocell In oRow.Cells
            Ocell.Select
                If Selection.Text = Chr(13) & Chr(7) Then
                    MsgBox Ocell.RowIndex & " " & Ocell.ColumnIndex & " is empty."
                End If
        Next Ocell
    Next oRow

End Sub

some VBA vocabulary

Selection.Tables Returns a Tables collection that represents all the tables in the specified selection.

Selection.Tables(1) This refers to the first table in a Tables collection

Chr(13) & Chr(7) This usually represents a bullet and line feed, but in Microsoft Word tables has special value of empty cell.

output in MS Word: