Enumerate through merged cells, Unhandled error

K

Krzysko

Dim i, j As Integer
wo = New Microsoft.Office.Interop.Word.Application
wo.ShowMe()
wd = wo.Documents.Open("c:\a.doc")
For Each wt As Table In wd.Tables
For i = 1 To wt.Rows.Count
For j = 1 To wt.Rows(i).Cells.Count
Try
If IsNothing(wt.Cell(i, j)) Then Exit For
MsgBox(wt.Cell(i, j).Range.Text())
Finally
j = wt.Columns.Count
End Try
Next j
Next i
Next wt
wo.Quit()

The clause try/catch/finally doesnt catch that error.
For Each doesn't work either.

Thanks for any help.
 
K

Krzysko

Fortunatelly I've found another method to enumerate and it doesn't hit
nonexisting cells:
do
....
wtcell = wtcell.Next
Loop While Not IsNothing(wtcell)
 
Top