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  

Table that is Page Size



 
 
Thread Tools Display Modes
  #1  
Old October 9th, 2008, 12:11 AM posted to microsoft.public.word.tables
cleo_cat
external usenet poster
 
Posts: 10
Default Table that is Page Size

Word 2003: Is it possible to tell a table that you want it to be the size of
one page?

I have a table that I want to be x # of rows long and y # columns wide. I
want the table to fill the whole page and then I can click "evenly distribute
rows," and "evenly distribute columns." However, I spend a lot of time trying
to resize the table to one page and then, often, when I click, "evenly
distribute rows," it bumps some of the rows over onto the next page. I keep
having to guess how big the rows should be.

Any ideas? Thank you in advance.
  #2  
Old October 9th, 2008, 08:11 AM posted to microsoft.public.word.tables
macropod[_2_]
external usenet poster
 
Posts: 2,402
Default Table that is Page Size

Hi cleo_cat,

The following macro fits all tables in a document to the height of the page of the section in which they appear. Row heights are
evenly distributed. Whether each table actually prints on a single page depends on whether there is anything else on the same pages.

Sub TableFit()
Application.ScreenUpdating = False
Dim oTopMargin As Single, oBottomMargin As Single, oBottomLine As Single
Dim oPageHeight As Single, oPrintHeight As Single, oRowHeight As Single
Dim oTable, i As Integer
If ActiveDocument.Tables.Count = 0 Then Exit Sub
For i = 1 To ActiveDocument.Tables.Count
oTable = ActiveDocument.Tables(i)
oBottomLine = 0
For each oCell in oTable.Rows(1)
For each oCell in oTable.Rows(oTable.Rows.Count)
If .Borders(wdBorderBottom).LineWidth oBottomLine Then _
oBottomLine = .Borders(wdBorderBottom).LineWidth
Next
With oTable.PageSetup
oTopMargin = .TopMargin
oBottomMargin = .BottomMargin
oPageHeight = .PageHeight
End With
oPrintHeight = oPageHeight - oTopMargin - oBottomMargin - oBottomLine /8 -1
oRowHeight = oPrintHeight / oTable.Rows.Count
With oTable.Rows
.Height = oRowHeight
.HeightRule = wdRowHeightExactly
End With
Next
Application.ScreenUpdating = True
End Sub


--
Cheers
macropod
[MVP - Microsoft Word]


"cleo_cat" wrote in message ...
Word 2003: Is it possible to tell a table that you want it to be the size of
one page?

I have a table that I want to be x # of rows long and y # columns wide. I
want the table to fill the whole page and then I can click "evenly distribute
rows," and "evenly distribute columns." However, I spend a lot of time trying
to resize the table to one page and then, often, when I click, "evenly
distribute rows," it bumps some of the rows over onto the next page. I keep
having to guess how big the rows should be.

Any ideas? Thank you in advance.


 




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 10:28 AM.


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