Error Handling in MS Word, Merged rows count issue
Posted on 2007-09-11
I have a Word Macro that I wrote that is supposed to count the number of rows in Column 1 of this table, as some are merged the usual table.rows.count doesn't work.
Any suggestions as to why I get a Debug Error when "only stop on unhandled errors" is selected at the line marked *, when I get to row 4, when in column 1 there are actually only 3 rows, due to merging. I know why the error occurs, I don't know how to handle it so it doesn't stop.
Function fMergedRows() As String
On Error GoTo Err_handler
Dim tbl As Table
Dim i As Integer
Dim strComma As String
Dim strMergedRows As String
Set tbl = ActiveDocument.Tables(1)
strComma = ""
For i = 1 To tbl.Rows.Count
Debug.Print tbl.Cell(i, 1).Creator
fMergedRows = fMergedRows & strComma & i
strComma = ","