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
- From the File menu, choose Print. Under Print What, select the Entire
Workbook option and choose Print Preview.
- 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.
- 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:
- 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
- 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.
|