Google Answers Logo
View Question
 
Q: Excel 2002 -- smart page setup for printing ( No Answer,   2 Comments )
Question  
Subject: Excel 2002 -- smart page setup for printing
Category: Computers > Software
Asked by: garymooney-ga
List Price: $10.00
Posted: 18 Jun 2002 07:50 PDT
Expires: 25 Jun 2002 07:50 PDT
Question ID: 28468
I need to find a utility (macro or add-in) for use with Excel 2002
that
1. Runs Page Setup for all pages of a workbook, producing exactly one
page per sheet, with the page orientation having been selected for
best fit; and
2. Presents all pages in Print Preview, allowing me to make
adjustments as necessary to expand any single page horizontally or
vertically  into more than one if the print is too small to read.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Excel 2002 -- smart page setup for printing
From: s_milberg-ga on 18 Jun 2002 14:21 PDT
 
since adding an answer and getting paid for it seems to be a
horrendous amount of work, and since i only found that out after
writing the answer to your question, you get an answer for free.  I
guess I'll have your eternal gratitude.  I'm not sure if you can
withdraw your question or if you are bound to pay unless no one
answers.  Either way:

Open a new workbook.
Open visual basic editor -> ALT + F11
Select new workbook from list in the project browser (top left window
pane, if you cannot see it, CTRL + R should summon it, the project
browser that is)
From menu bar: Insert -> Module

then, copy and paste the following code (without the stars)

**********************

Sub Format_For_Print()

'note that Excel cannot scale to less than 10% or more than 400%
making it impossible to fit
'documents with many, many rows or many many columns on 1 page

Dim sh_Sheet As Worksheet
Dim i As Integer

For Each sh_Sheet In Application.ActiveWorkbook.Worksheets

    sh_Sheet.Activate

    If TypeName(sh_Sheet) <> "Chart" Then

        ActiveWindow.View = xlPageBreakPreview
                
        'determine whether portrait or landscape depending on
height:width ratio
                
        With ActiveSheet.PageSetup
                
        Select Case ActiveSheet.UsedRange.Height /
ActiveSheet.UsedRange.Width
        
        Case Is >= 1
        
        For i = 1 To 2
            
            .Orientation = xlPortrait
            .Zoom = False
            .FitToPagesWide = False
            .FitToPagesTall = 1
        
        Next
            
        Case Is < 1
        
        For i = 1 To 2
            
            .Orientation = xlLandscape
            .Zoom = False
            .FitToPagesTall = False
            .FitToPagesWide = 1
            
        Next
        
        End Select
        
        End With
    
    End If
    
Next

End Sub

*****************

you should then be able to run the macro as you would any other macro.
 be sure to have the workbook you inserted the module in open, and the
workbook you want formatted selected (otherwise you are going to
format whatever happens to be the active workbook).

Cheers,


Sadao
Subject: Re: Excel 2002 -- smart page setup for printing
From: s_milberg-ga on 18 Jun 2002 14:26 PDT
 
Caveat on above macro, it was written for xl 97, but it should work
for 2002.  Also, there are a couple of line breaks that google has
added.  Those line break could cause the macro to gag.  Be sure to
remove them before running the macro.  Alternatively, post your e-mail
address here and I'll send you the workbook as is or a text file (if
you fear an infected workbook) without line breaks.

Sadao

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy