PC Review


Reply
Thread Tools Rate Thread

Auto height adjustment to fit on a single printed page

 
 
TheObstacleIsThePath@gmail.com
Guest
Posts: n/a
 
      14th Nov 2008
Here's my latest puzzle:

I have a form in Excel 2003 that is populated by word-wrapped text
fields with a variable length (and ultimately variable height). I
have a macro that will auto-fit row height on these fields to make
things tidy.

The form also has something equivalent to a footer that I need to
force to the bottom of a printed page. I manually accomplish this by
stretching the last row, and checking page-preview to confirm that
footer is the last thing on page 1.

Is there a way to poll excel for the number of pages a spreadsheet
will take if printed? With this, I could write a macro to
incrementally decrease a row height until the number of pages falls to
1.

Using a word mailmerge or proper excel footers is not really practical
in this case.

Any hints would be appreciated.

 
Reply With Quote
 
 
 
 
Steve
Guest
Posts: n/a
 
      14th Nov 2008
On Nov 14, 8:19*am, "TheObstacleIsTheP...@gmail.com"
<TheObstacleIsTheP...@gmail.com> wrote:
> Here's my latest puzzle:
>
> I have a form in Excel 2003 that is populated by word-wrapped text
> fields with a variable length (and ultimately variable height). *I
> have a macro that will auto-fit row height on these fields to make
> things tidy.
>
> The form also has something equivalent to a footer that I need to
> force to the bottom of a printed page. *I manually accomplish this by
> stretching the last row, and checking *page-preview to confirm that
> footer is the last thing on page 1.
>
> Is there a way to poll excel for the number of pages a spreadsheet
> will take if printed? *With this, I could write a macro to
> incrementally decrease a row height until the number of pages falls to
> 1.
>
> Using a word mailmerge or proper excel footers is not really practical
> in this case.
>
> Any hints would be appreciated.


By doing a search on google for excel vba get number of printed pages,
I came across this:

Sub NumberOfPrintedPages()
Worksheets(1).DisplayAutomaticPageBreaks = True
HorizBreaks = Worksheets(1).HPageBreaks.Count
HPages = HorizBreaks + 1
VertBreaks = Worksheets(1).VPageBreaks.Count
VPages = VertBreaks + 1
NumPages = HPages * VPages
Worksheets(1).DisplayAutomaticPageBreaks = False
MsgBox NumPages
End Sub

I found this on http://spreadsheetpage.com/index.php...printed_pages/.

Hope this helps,

Steve
 
Reply With Quote
 
TheObstacleIsThePath@gmail.com
Guest
Posts: n/a
 
      14th Nov 2008
On Nov 14, 11:10*am, Steve <sithiu...@gmail.com> wrote:
> On Nov 14, 8:19*am, "TheObstacleIsTheP...@gmail.com"
>
>
>
>
>
> <TheObstacleIsTheP...@gmail.com> wrote:
> > Here's my latest puzzle:

>
> > I have a form in Excel 2003 that is populated by word-wrapped text
> > fields with a variable length (and ultimately variable height). *I
> > have a macro that will auto-fit row height on these fields to make
> > things tidy.

>
> > The form also has something equivalent to a footer that I need to
> > force to the bottom of a printed page. *I manually accomplish this by
> > stretching the last row, and checking *page-preview to confirm that
> > footer is the last thing on page 1.

>
> > Is there a way to poll excel for the number of pages a spreadsheet
> > will take if printed? *With this, I could write a macro to
> > incrementally decrease a row height until the number of pages falls to
> > 1.

>
> > Using a word mailmerge or proper excel footers is not really practical
> > in this case.

>
> > Any hints would be appreciated.

>
> By doing a search on google for excel vba get number of printed pages,
> I came across this:
>
> Sub NumberOfPrintedPages()
> * * Worksheets(1).DisplayAutomaticPageBreaks = True
> * * HorizBreaks = Worksheets(1).HPageBreaks.Count
> * * HPages = HorizBreaks + 1
> * * VertBreaks = Worksheets(1).VPageBreaks.Count
> * * VPages = VertBreaks + 1
> * * NumPages = HPages * VPages
> * * Worksheets(1).DisplayAutomaticPageBreaks = False
> * * MsgBox NumPages
> End Sub
>
> I found this onhttp://spreadsheetpage.com/index.php/tip/determining_the_number_of_pr....
>
> Hope this helps,
>
> Steve- Hide quoted text -
>
> - Show quoted text -


Works like a charm. Thanks for the resource!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel row height v. printed page Geri Rigger Microsoft Excel Worksheet Functions 4 6th Nov 2009 05:29 AM
Auto Cell Height Adjustment for text entered Solex Microsoft Excel Misc 3 19th Jun 2009 01:18 PM
Multiple sheets printed to single page Docwatmo Microsoft Excel Discussion 1 23rd May 2007 10:04 PM
Set up a single page to print a chronolgy of sheets printed =?Utf-8?B?c3JmcjgwOA==?= Microsoft Excel Misc 1 10th May 2005 10:28 AM
Numbering printed copies of single page documeny =?Utf-8?B?U2FsbHkgU3Vl?= Microsoft Word Document Management 1 11th Feb 2004 05:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:36 PM.