Table that is Page Size

C

cleo_cat

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.
 
M

macropod

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
 

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