kkrishna


Hi All,

I wrote a macro that formats the cell text of all the tables in the Word document, if the tables are uniform. Since the macro accesses each cell for formatting, I wanted to avoid formatting non-uniform tables. This works quite well for Word docs generated from databases.

I converted a pdf document to Word using Acrobat 7. The generated Word document has many tables and all of them appear to be uniform i.e no merged cells. When I run the above macro, I get the message that the tables are not uniform, and hence not formatted. When I manually select the table, the entire table gets selected i.e there are no split tables.

I ran the following macro on a 13-row table to find out whether the cells are different from appearance.

Sub TestMacroOne()
Dim oTable As Table
Dim oRow As Row
Dim x As Integer
Dim msg As String
Set oTable = ActiveDocument.Tables(1)

x = 1
If (oTable.Uniform = False) Then
msg = ""
For Each oRow In oTable.Rows
msg = msg & "Row " & x & " : Cells: " & (oRow.Cells.Count) & Chr(13)
x = x + 1
Next oRow
End If
MsgBox msg
MsgBox "All Done"
End Sub

The message box shows that each of the 13 rows has 6 cells. I cannot understand why the table is not uniform.

Will someone please help me

Thanks in advance