Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
Tom Tom is offline
external usenet poster
 
Posts: 61
Default macro that repeats header rows of all tables?

Does anyone know how to make a macro that repeats the header row of
tables that span multiple pages? This is done by selecting the table
and going to Table Heading Rows repeat. If I have a document with 20
tables, I would like to automate this via a macro, but I'm not sure how.

  #2   Report Post  
Posted to microsoft.public.word.tables
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default macro that repeats header rows of all tables?

The following macro will do it:

Sub MakeHeadingRows()
Dim i As Long
With ActiveDocument
For i = 1 To .Tables.Count
.Tables(i).Rows(1).HeadingFormat = True
Next i
End With
End Sub


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Tom" wrote in message
oups.com...
Does anyone know how to make a macro that repeats the header row of
tables that span multiple pages? This is done by selecting the table
and going to Table Heading Rows repeat. If I have a document with 20
tables, I would like to automate this via a macro, but I'm not sure how.



  #3   Report Post  
Posted to microsoft.public.word.tables
Stefan Blom Stefan Blom is offline
external usenet poster
 
Posts: 8,428
Default macro that repeats header rows of all tables?

Use the HeadingFormat property (defined for Row objects). For example,
to set the first row of all tables in the active document to be
heading rows, use a macro such as the following:

Sub test()
Dim t As Table
For Each t In ActiveDocument.Tables
t.Rows(1).HeadingFormat = True
Next t
End Sub

--
Stefan Blom
Microsoft Word MVP


"Tom" wrote in message
oups.com...
Does anyone know how to make a macro that repeats the header row of
tables that span multiple pages? This is done by selecting the table
and going to Table Heading Rows repeat. If I have a document with

20
tables, I would like to automate this via a macro, but I'm not sure

how.




  #4   Report Post  
Posted to microsoft.public.word.tables
Tom Tom is offline
external usenet poster
 
Posts: 61
Default macro that repeats header rows of all tables?

Thanks! The macro worked perfectly. I also wanted to indent the tables,
so I added another parameter in there from a different macro.

Sub Fixmytables()
Dim t As Table
For Each t In ActiveDocument.Tables
t.Rows(1).HeadingFormat = True
t.Rows.LeftIndent = CentimetersToPoints(2.9)
Next t
End Sub

Can you tell me where I would find all the parameters that I can apply
for tables? Thanks for your help.

  #5   Report Post  
Posted to microsoft.public.word.tables
Tom Tom is offline
external usenet poster
 
Posts: 61
Default macro that repeats header rows of all tables?

Thanks! The macro worked perfectly. I also wanted to indent the tables,
so I added another parameter in there from a different macro.

Sub Fixmytables()
Dim t As Table
For Each t In ActiveDocument.Tables
t.Rows(1).HeadingFormat = True
t.Rows.LeftIndent = CentimetersToPoints(2.9)
Next t
End Sub

Can you tell me where I would find all the parameters that I can apply
for tables? Thanks for your help.



  #6   Report Post  
Posted to microsoft.public.word.tables
Tom Tom is offline
external usenet poster
 
Posts: 61
Default macro that repeats header rows of all tables?

Thanks! The macro worked perfectly. I also wanted to indent the tables,
so I added another parameter in there from a different macro.

Sub Fixmytables()
Dim t As Table
For Each t In ActiveDocument.Tables
t.Rows(1).HeadingFormat = True
t.Rows.LeftIndent = CentimetersToPoints(2.9)
Next t
End Sub

Can you tell me where I would find all the parameters that I can apply
for tables? Thanks for your help.

  #7   Report Post  
Posted to microsoft.public.word.tables
Tom Tom is offline
external usenet poster
 
Posts: 61
Default macro that repeats header rows of all tables?

Thanks! The macro worked perfectly. I also wanted to indent the tables,
so I added another parameter in there from a different macro.

Sub Fixmytables()
Dim t As Table
For Each t In ActiveDocument.Tables
t.Rows(1).HeadingFormat = True
t.Rows.LeftIndent = CentimetersToPoints(2.9)
Next t
End Sub

Can you tell me where I would find all the parameters that I can apply
for tables? Thanks for your help

  #8   Report Post  
Posted to microsoft.public.word.tables
Stefan Blom Stefan Blom is offline
external usenet poster
 
Posts: 8,428
Default macro that repeats header rows of all tables?

Read about the Table object in Word VBA Help. Or use the Object
Browser (press F2 with the Visual Basic Editor displayed). There you
can view objects, their properties and methods, and use F1 to display
help on specific items.

--
Stefan Blom
Microsoft Word MVP


"Tom" wrote in message
ps.com...
Thanks! The macro worked perfectly. I also wanted to indent the

tables,
so I added another parameter in there from a different macro.

Sub Fixmytables()
Dim t As Table
For Each t In ActiveDocument.Tables
t.Rows(1).HeadingFormat = True
t.Rows.LeftIndent = CentimetersToPoints(2.9)
Next t
End Sub

Can you tell me where I would find all the parameters that I can

apply
for tables? Thanks for your help





  #9   Report Post  
Posted to microsoft.public.word.tables
[email protected] satya.mahesh@gmail.com is offline
external usenet poster
 
Posts: 1
Default macro that repeats header rows of all tables?

Thanks for the macro code. I did try the code and it worked well for
tables which did not have any merged cells. For tables with merged
cells it gave an error. How do we take care of such validations here?

My document has lot of tables and I want to repeat the table headers as
the tables span across pages and it is difficult to read. Some tables
have merged cells as well.

Can a macro handle these scenarios and repeat table headers for valid
tables only?


Doug Robbins - Word MVP wrote:
The following macro will do it:

Sub MakeHeadingRows()
Dim i As Long
With ActiveDocument
For i = 1 To .Tables.Count
.Tables(i).Rows(1).HeadingFormat = True
Next i
End With
End Sub


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Tom" wrote in message
oups.com...
Does anyone know how to make a macro that repeats the header row of
tables that span multiple pages? This is done by selecting the table
and going to Table Heading Rows repeat. If I have a document with 20
tables, I would like to automate this via a macro, but I'm not sure how.


  #10   Report Post  
Posted to microsoft.public.word.tables
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default macro that repeats header rows of all tables?

The following won't be as quick, but will overcome that problem

Sub MakeHeadingRows()
Dim i As Long
With ActiveDocument
For i = 1 To .Tables.Count
.Tables(i).Cell(1, 1).Select
Selection.Rows.HeadingFormat = True
Next i
End With
End Sub


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

wrote in message
oups.com...
Thanks for the macro code. I did try the code and it worked well for
tables which did not have any merged cells. For tables with merged
cells it gave an error. How do we take care of such validations here?

My document has lot of tables and I want to repeat the table headers as
the tables span across pages and it is difficult to read. Some tables
have merged cells as well.

Can a macro handle these scenarios and repeat table headers for valid
tables only?


Doug Robbins - Word MVP wrote:
The following macro will do it:

Sub MakeHeadingRows()
Dim i As Long
With ActiveDocument
For i = 1 To .Tables.Count
.Tables(i).Rows(1).HeadingFormat = True
Next i
End With
End Sub


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Tom" wrote in message
oups.com...
Does anyone know how to make a macro that repeats the header row of
tables that span multiple pages? This is done by selecting the table
and going to Table Heading Rows repeat. If I have a document with 20
tables, I would like to automate this via a macro, but I'm not sure
how.




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro name different in Organizer Tarallen Microsoft Word Help 6 November 13th 06 06:18 PM
I can't get header rows to repeat in tables. Carpedyce Tables 2 November 10th 06 11:16 PM
Tables take up room in header when crossing pages harry Microsoft Word Help 1 October 13th 06 05:57 AM
wordcount macro for tables and brackets Nikeel Tables 2 December 30th 05 07:43 PM
Two rows repeating as header row George Wilson Tables 1 December 13th 04 09:36 PM


All times are GMT +1. The time now is 10:31 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"