Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default How many rows fit a single page?

(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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default How many rows fit a single page?

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
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?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default How many rows fit a single page?

Thanks, Jim. The margins for this will not change.

What is the "400"? Points? Or just an arbitrary number used for
measurement according to whatever Excel is using?

Ed


On Apr 1, 12:49*pm, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com wrote:
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- Hide quoted text -


- Show quoted text -


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default How many rows fit a single page?

Hi, Howard. part of the issue here is that for this report, I need to
have a header for the table. If the table breaks over a page, the
header has to say "Table 1 (continued)", except on the last page where
it becomes "Table 1 (concluded)." If I know how many pages I'm
spreading onto, I can set the headers and then copy over the rows.
Yes, I could just format the table to repeat the top rows as header
and do not break rows across pages, but then I lose that ability to
set the header on top. Unless you know of a way . . .

Ed

On Apr 1, 1:27*pm, "Howard Kaikow" wrote:

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?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving Excel 2010 files as web page or single file web page Joe Artis Excel Discussion (Misc queries) 3 April 29th 23 03:44 AM
colating multi rows of data into single rows - no to pivot tables! UKMAN Excel Worksheet Functions 4 March 12th 10 04:11 PM
how do you print single page multiply times with increasing page . aliasmith Excel Worksheet Functions 2 September 26th 08 12:30 AM
Page numbers on copies of a single page worksheet sr accountant Excel Discussion (Misc queries) 1 May 7th 07 06:29 PM
Printing multiple page worksheets on 1 single page Hope Excel Discussion (Misc queries) 1 January 7th 07 03:56 AM


All times are GMT +1. The time now is 01:04 AM.

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

About Us

"It's about Microsoft Excel"