|
|
Hello, I've got some tables in a document and I'm checking (with VBA) for these tables if they have "Heading Rows Repeat" for their first row. The problem is : if I have a multiple heading rows with some cells merged, VBA tell me this : "Cannot access individual rows in this collection because the table has vertically merged cells".
Here is the code used : For Each myTable In ActiveDocument.Tables myTable.Rows(1).Select If Not Selection.Rows.HeadingFormat = wdToggle Then addVerifyWarning "Heading Rows Repeat must be set in tables' first row.", myTable.Range.Paragraphs(1) End If Next
Is there a problem with this code ?
|
|
Hi Thomas,
I don't know what "addVerifyWarning" is.
For checking for headers and circumventing the error you get, you may try:
Sub Test459() Dim mytable As Table For Each mytable In ActiveDocument.Tables mytable.Range.Cells(1).Select If Not Selection.Rows.HeadingFormat = wdToggle Then MsgBox "Warning" End If Next End Sub
-- Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003 "red.sys" & Chr$(64) & "t-online.de"
|
|
|