Add to PrintOut function to specify layout, paper size, etc.

nbuk

New Member
Joined
Jun 25, 2010
Messages
30
I need to print out several tables based on some user input (I have the code for that bit and it works great).

My problem is that I am not familiar with the PrintOut function.

Here is that I have so far:

Code:
If Sheet2.Range("P14").Value = True Then
    Sheet5.Range("A1:O25").PrintOut
    Sheet5.Range("A27:O51").PrintOut
    Sheet5.Range("A53:O77").PrintOut
    Sheet5.Range("A79:O103").PrintOut

ElseIf Sheet2.Range("P15").Value = True Then
    Sheet5.Range("A105:O129").PrintOut
    Sheet5.Range("A131:O155").PrintOut
    Sheet5.Range("A157:O181").PrintOut
    Sheet5.Range("A183:O207").PrintOut
    Sheet5.Range("A209:O233").PrintOut
    Sheet5.Range("A235:O259").PrintOut
    Sheet5.Range("A261:O285").PrintOut
    Sheet5.Range("A287:O311").PrintOut
Else
    Sheet5.Range("A1:O25").PrintOut
    Sheet5.Range("A27:O51").PrintOut
    Sheet5.Range("A53:O77").PrintOut
    Sheet5.Range("A79:O103").PrintOut
    Sheet5.Range("A105:O129").PrintOut
    Sheet5.Range("A131:O155").PrintOut
    Sheet5.Range("A157:O181").PrintOut
    Sheet5.Range("A183:O207").PrintOut
    Sheet5.Range("A209:O233").PrintOut
    Sheet5.Range("A235:O259").PrintOut
    Sheet5.Range("A261:O285").PrintOut
    Sheet5.Range("A287:O311").PrintOut
End If
How can I modify that code to add:

expression.PrintOut(Background, Append, Range, OutputFileName, From, To, Item, Copies, Pages, PageType, PrintToFile, Collate, FileName, ActivePrinterMacGX, ManualDuplexPrint, PrintZoomColumn, PrintZoomRow, PrintZoomPaperWidth, PrintZoomPaperHeight)

I would like to set the paper size to legal and orientation to landscape, send the tables to the default printer, and make sure they are fit to the sheet.

Thank you
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,215,003
Messages
6,122,655
Members
449,091
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top