Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to detect Height of the printable area in Excel Print Preview?

Status
Not open for further replies.

mtchary

Programmer
Mar 4, 2004
18
CA
How to detect Height of the printable area in Excel Print Preview?
Each time, after I change Font in the Format -> Style dialog box, it has different value

TIA
 
What you'd need to do is:
a) calculate this maximum possible number of points height within the page margins; then
b) add up the point heights of all rows until you can't fit any more into the number of number of points height within the page margins, keeping a row count as you go along.

Cheers
 
That is what I do. But Excel has it is own routine to determin height of printable area, and this value vary depend on font stle and size
 
mtchary,

What is your ultimate objective beyond having a value for the height?

Skip,

Be advised: Alcohol and Calculus do not mix!
If you drink, don't derive!

Want to get great answers to your Tek-Tips questions? Have a look at faq222-2244
 
Hi mtchary,

When you say "Excel has it is own routine to determin(e) height of printable area, and this value (may) vary depend(ing) on font stle and size", that is only because Excel adjusts row heights to suit the font requirements. If you were to fix the row heights, then changing fonts would have no effect.

Take a look at the 'table craziness' thread in this forum from 29 July for a discussion on fitting Word tables to page heights. Although that discussion concerned making a given number of rows fit the page, it deals with many of the same issues you'd be dealing with in tring to determine how many rows from an Excel spreadsheet would print on a page.

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top