Group:  Microsoft Word ยป microsoft.public.word.vba.customization
Thread: VBA, Heading Rows Repeat & Multiple Heading Rows

Geek News

VBA, Heading Rows Repeat & Multiple Heading Rows
Thomas 6/18/2007 10:44:01 AM
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 ?
Re: VBA, Heading Rows Repeat & Multiple Heading Rows
Helmut Weber <nbhymsjxdgcn[ at ]mailinator.com> 6/30/2007 7:03:01 AM
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"

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net