View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Howard Kaikow Howard Kaikow is offline
external usenet poster
 
Posts: 269
Default How many rows fit a single page?

"Jim Thomlinson" wrote in message
...
You are going to have certain difficulties with this as it depends on the
margins you set in Word. When those change your code will need to change.
Here is some simple code to get you started. It does not look at the

margins
in Word...

Sub test()
Dim dbl As Double
Dim rng As Range
Dim rngToSearch As Range

Set rngToSearch = Range("A1", Cells(Rows.Count, "A").End(xlUp))
For Each rng In rngToSearch
dbl = dbl + rng.Height
If dbl 400 Then 'You will need to change this to suit
MsgBox rng.Address
dbl = 0
End If
Next rng
End Sub
--
HTH...

Jim Thomlinson


"Ed from AZ" wrote:

(Word and Excel 2003) I have an Excel table that my code scans, picks
so many rows, and then copies that into a Word document as a table.
This worked okay when all my rows were a single fixed height. I've
just received instructions to add some info items to this table, which
will increase some row sizes due to word wrap.

Is there a good way to determine how many rows will fit inside the
margins of my Word page? Perhaps add the height of each row until I
get to a certain number? Or can I detect and use the page break
somehow for this?

Ed


In Word, the style of each paragraph, as well as the number of lines
before/after, etc. must be considered.

Word has the ability to break rows at appropriate points and repeat headers
on each page.
Do you need more than that?