View Single Post
 
Old 08-20-2015, 08:08 PM
Guessed's Avatar
Guessed Guessed is offline Windows 7 32bit Office 2010 32bit
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,184
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I don't know that this way is really any better but it is an alternative that might get you thinking. I was hoping I could use aRng.Information(wdVerticalPositionRelativeToPage) to make an elegant solution but I couldn't be bothered figuring it out properly
Code:
Sub Macro1()
  Dim aRng As Range, aCell As Cell
  Dim iCurrPage As Integer, lngPageHeight As Long
  
  Set aCell = ActiveDocument.Tables(1).Cell(1, 1)
  Set aRng = aCell.Range
  aRng.Collapse Direction:=wdCollapseEnd
  iCurrPage = aRng.Information(wdActiveEndPageNumber)
  
  aCell.HeightRule = wdRowHeightExactly
  lngPageHeight = aRng.Sections(1).PageSetup.PageHeight
  aCell.SetHeight RowHeight:=lngPageHeight, HeightRule:=wdRowHeightExactly
  Do Until aRng.Information(wdActiveEndPageNumber) = iCurrPage
    aCell.SetHeight RowHeight:=aCell.Height - 18, HeightRule:=wdRowHeightExactly
  Loop
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote