Thread: Tables in Word
View Single Post
  #2   Report Post  
Posted to microsoft.public.word.tables
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Tables in Word

Hi Mischa,

When you create a table, Word ordinarilygives it equal column widths and makes it fill the space between the margins. The only thing
you're left to do is to adjust the row heights.

The following macro fits all selected tables in a document to the height of the page in the Section in which they appear. Whether
the tables actually print that way 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, oCell As Cell, i As Integer, j As Integer
With Selection
j = .Tables.Count
If j = 0 Then Exit Sub
For i = 1 To j
oTable = .Tables(i)
oBottomLine = 0
With oTable
For Each oCell In oTable.Rows(oTable.Rows.Count).Cells
If .Borders(wdBorderBottom).LineWidth oBottomLine Then _
oBottomLine = .Borders(wdBorderBottom).LineWidth
Next
With .PageSetup
oTopMargin = .TopMargin
oBottomMargin = .BottomMargin
oPageHeight = .PageHeight
End With
oPrintHeight = oPageHeight - oTopMargin - oBottomMargin - oBottomLine / 8 - 1
oRowHeight = oPrintHeight / .Rows.Count
With .Rows
.Height = oRowHeight
.HeightRule = wdRowHeightExactly
End With
End With
Next
End With
Application.ScreenUpdating = True
End Sub


--
Cheers
macropod
[Microsoft MVP - Word]


"Mischa" wrote in message ...
I want to create a table in Word which has about 10 columns, 20 row, and
covers an entire page. When I try to create such a table, I get a little
table which takes up about one-third of the page. When I try to draw the
table I want, I can never make the column the same size or the rows the same
size. Does any one know how I can create the table I would like to have?
Thank you,
Mischa