How do I report a bug in Office 2003 on Tables properties?

H

Hank Freeman

In MS Word you can set a table properties you can set "Repeat as Header row
on the top of each Page"... However, when trying to do it in VBA behind
Office in a Macro as listed below it does not work.
Sub Macro1()
Selection.Tables(1).Rows.HeadingFormat = True
End Sub

Please advise the correct VBA Syntax..
Additional documentation available upon request
 
J

Jezebel

The bug is in your code. You have to specify which rows you want as heading
rows. Word is smart enough to know that you don't want ALL of them ...

Selection.Tables(1).Rows(2).HeadingFormat = true

Setting a row to true also sets the rows above it; setting a row to false
also clears the rows below it.
 
P

Pat Garard

G'Day Hank,

Your Macro works perfectly as long as you have made a
SELECTION that includes a Table (or the Insertion Point
is already within the Header Row of a Table).

You need to generalise it to:

Sub Macro1()
ActiveDocument.Tables(1).Rows.HeadingFormat = True
End Sub

OR

Sub Macro1()
Dim intX as Integer
intX = 1 ' Or whatever ...
ActiveDocument.Tables(intX).Rows.HeadingFormat = True
End Sub
 
B

bbowen8

I had a lot of trouble with this feature too. I basically discovered
that my entire table (not just the first row) was set to repeat. So
what I had to do was select the table, turn off "repeat as header row"
for the whole table, and then just select the first row and set it
again. But I had a lot of tables and wrote this macro which cleaned
them all up by turning it off, then on again only for row 1.

Bill

Sub HeadingRows()
Dim n As Integer

For n = 1 To ActiveDocument.Tables.Count
ActiveDocument.Tables(n).Select
With Selection
.Rows.HeadingFormat = False
.Rows(1).HeadingFormat = True
End With
Next

End Sub
 

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