# Setting a property for all tables in a Word document



## longtalker (Oct 28, 2008)

I have lots of tables in my document, and would like to change them all to have the header row repeated on the next page in case the table is split on two pages. 

Is there any other way to do this other than doing it manually for each table?

The simplest way would be, I think, if there were a style (that I don't know of!) that governs table properties for all tables in the document. Or at least if I could somehow select all tables in the document, and make that setting directly, but only once for all tables (although I'd rather do it using styles..)

Thanks for any help! I am using Word 2007 on Windows XP.


----------



## macropod (Apr 11, 2008)

Hi longtalker,

You could use a macro to do this. The code is trivial:

```
Sub SetTableHeadingRows()
Dim oTbl As Table
For Each oTbl In ActiveDocument.Tables
  oTbl.Rows(1).HeadingFormat = True
Next
End Sub
```
Note: if you place this code in a Word 2007-format document, it'll have to be saved as a macro-enabled document (ie .docm, not .docx).


----------

