A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

macro that repeats header rows of all tables?



 
 
Thread Tools Display Modes
  #1  
Old December 15th, 2006, 02:59 PM posted to microsoft.public.word.tables
Tom
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  
Old December 15th, 2006, 03:11 PM posted to microsoft.public.word.tables
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,239
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  
Old December 15th, 2006, 03:14 PM posted to microsoft.public.word.tables
Stefan Blom
external usenet poster
 
Posts: 8,433
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  
Old December 15th, 2006, 04:05 PM posted to microsoft.public.word.tables
Tom
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  
Old December 15th, 2006, 04:05 PM posted to microsoft.public.word.tables
Tom
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  
Old December 15th, 2006, 04:05 PM posted to microsoft.public.word.tables
Tom
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  
Old December 15th, 2006, 04:06 PM posted to microsoft.public.word.tables
Tom
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  
Old December 15th, 2006, 04:16 PM posted to microsoft.public.word.tables
Stefan Blom
external usenet poster
 
Posts: 8,433
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  
Old December 19th, 2006, 10:29 PM posted to microsoft.public.word.tables
[email protected]
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  
Old December 20th, 2006, 10:06 AM posted to microsoft.public.word.tables
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,239
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.




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:05 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.