Accessing an uneven table

  • Thread starter Stein Kristiansen
  • Start date
S

Stein Kristiansen

I have a function detecting if all the cells in a table consist of text with
hidden font:
----------------------
Public Function OnlyHiddenTextinTable(oTable As Table) As Boolean
OnlyHiddenTextinTable = True
Dim oRow As Row
Dim oCell As Cell
For Each oRow In oTable.Rows
For Each oCell In oRow.Cells
If oCell.Range.Font.Hidden <> True Then
OnlyHiddenTextinTable = False
Exit Function
End If
Next 'oCell
Next 'oRow
End Function
-----------------
The function works fine until it runs into a table with merged cells, then
it crashes.

Does anyone have a workaround this problem?

Regards
Stein
 
H

Helmut Weber

Hi Stein,

like this:

Dim oCll As Cell
For Each oCll In ActiveDocument.Tables(1).Range.Cells
' some code
Next

Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top