XL5: Sheets in Wrong Orientation with Print Entire Workbook

Last reviewed: September 2, 1997
Article ID: Q111943
The information in this article applies to:
  • Microsoft Excel for Windows, version 5.0

SYMPTOMS

In Microsoft Excel, when you open a workbook that contains worksheets with different page setup orientations, and you print the entire workbook, some of the worksheets may be printed with the wrong page orientation.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Excel for Windows version 5.0c.

WORKAROUNDS

To work around this problem, you must re-establish the orientation for each sheet; you can do this manually, or you can use a macro to do it automatically.

To re-establish the orientation manually

  1. From the File menu, choose Print. Under Print What, select the Entire Workbook option and choose Print Preview.

  2. For each worksheet in the workbook that is displayed in the wrong orientation, choose the Setup button.

    Note that on the Page tab in the Page Setup dialog box, the correct option under Orientation is selected. Choose OK.

  3. Choose the Next button to view the next worksheet in the workbook. Repeat steps 2 and 3 for the each sheet in the workbook.

The entire workbook will be printed correctly as long as the workbook remains open (you will have to repeat this procedure if you close and reopen the workbook).

To re-establish the orientation automatically

The following macro adjusts the page orientation and prints the entire workbook correctly. To use the macro:

  1. Enter the following code on a macro sheet:

          Sub PrintOutWorkbook()
          Dim Page As Object
          'Loop through each Worksheet in the active workbook
          'using "Page" as a loop variable.
          For Each Page In ActiveWorkbook.Worksheets
              'Reset page orientation to itself
              Page.PageSetup.Orientation = Page.PageSetup.Orientation
          'End of loop
          Next Page
              'Print the Entire Workbook
              ActiveWorkbook.PrintOut
          End Sub
    
    

  2. To run the macro, use the Menu Editor to assign it to a toolbar button or menu command, run it directly from the macro dialog box.

Microsoft provides examples of Visual Basic for Applications procedures for illustration only, without warranty either expressed or implied, including, but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Visual Basic procedures in this article are provided 'as is' and Microsoft does not guarantee that they can be used in all situations. While Microsoft support engineers can help explain the functionality of a particular macro, they will not modify these examples to provide added functionality, nor will they help you construct macros to meet your specific needs. If you have limited programming experience, you may want to consult one of the Microsoft Solution Providers. Solution Providers offer a wide range of fee-based services, including creating custom macros. For more information about Microsoft Solution Providers, call Microsoft Customer Information Service at (800) 426-9400.


Additional query words: 5.00
Keywords : kbprg PgmOthr
Version : 5.00
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 2, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.