program to print some landscape, some portrait?

H

honestlylion

I am creating a two page device status report in Excel. VBA code will be
run to populate the fields of the report and save a the report as a file
- one for each device listed in the database (approx. 1000). It is
necessary for me to print each of these reports for our contractors,
and desireable that each two page report be printed on a single page
(front and back).

The issue is that the first page needs to print in a Portrait format,
and the second in Landscape format. Is it possible to print two pages
of the same worksheet back-to-back AND have each side in the desired
format(portrait/landscape). Any suggestions to accomplish this are
greatly appreciated.
 
G

Guest

By "two page report" do you mean the data is on two spreadsheets, or one
spreadsheet that prints two pages in length?.

Printing both sides of a single piece of paper requires two passes (usually).

For two spreadsheets: set orientation for each sheet in PageSetup. Print
the first, then the second.

For one spreadsheet:
Assign a local Defined Name for each 'page range' of cells. (eg:
"Pg1_Print", "Pg2_Print")
Use a macro for each print pass, that sets the orientation for each range.
Run macro1, then reload the paper and run macro2.

possible coding: identical for both orientations
Sub PrintPg1() '( PrintPg2() for 2nd macro)
With ActiveSheet.Range("Pg1_Print") '( "Pg2_Print" for 2nd macro)
With .PageSetup
'set parameters how you want
.Orientation = xlPortrait '( xlLandscape for 2nd macro)
End With
'print it, OR preview it
End With
End Sub

This would be similar to selecting the range manually and choosing '
Selection ' in the Prit dialog.
Use the macro recorder and do it manually. This will give you some idea of
what code to use for PageSetup parameters. Do not include any printer
specific parameters (eg: PrintQuality) to avoid an error message if another
user has a different printer.

Hope this helps!
GS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top