Print to papersize A3 or A4 to a printer with different trays

Skagga5

New Member
Joined
May 23, 2013
Messages
11
Hi

I have seen a similar threat on here posted in 2009 but unfortunately it doesnt quite answer the issue I am having.

I have done a userform which allows the user to select printing to each section(All, A, B or C) of the report to either paper size A3 or A4 looking something like below -
Print All A3 A4 (these buttons are option buttons)
Print A A3 A4
Prtint B A3 A4
Print C A3 A4

I have coded and part recorded a macro to change the paper size to either A3 or A4 depending on the user's selection.

The problem i have is if i take out the print command, it seems to change the paper sizes as it should but when i print it prints to the same size as the previous print i did, regardless of what was selected on the userform
icon8.png
.

I have a printer with multiple tray sizes, and since I need to change paper sizes, I assume i need to change trays as well.

Any help on this issue would be much appreciated.

Below is the two macros -

'''''''''''''Set Print area and print to A3'''''''''''''''''

Private Sub PrintAllA3_Click()<o:p></o:p>
Dim LastRow As Long<o:p></o:p>
Dim LastCol As Long<o:p></o:p>
<o:p></o:p>
With ActiveSheet<o:p></o:p>
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row<o:p></o:p>
LastCol = .Cells(2, .Columns.Count).End(xlToLeft).Column<o:p></o:p>
End With<o:p></o:p>
<o:p></o:p>
Range(Cells(1, 1), Cells(LastRow, LastCol)).Select<o:p></o:p>
ActiveSheet.PageSetup.PrintArea = Selection<o:p></o:p>
<o:p></o:p>
Application.PrintCommunication = False<o:p></o:p>
With ActiveSheet.PageSetup<o:p></o:p>
.PrintTitleRows = "$2:$2"<o:p></o:p>
.PrintTitleColumns = ""<o:p></o:p>
End With<o:p></o:p>
Application.PrintCommunication = True<o:p></o:p>
Application.PrintCommunication = False<o:p></o:p>
With ActiveSheet.PageSetup<o:p></o:p>
.PaperSize = xlPaperA3<o:p></o:p>
End With<o:p></o:p>
Application.PrintCommunication = True<o:p></o:p>
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _<o:p></o:p>
IgnorePrintAreas:=False<o:p></o:p>
<o:p></o:p>
ActiveSheet.PageSetup.PrintArea = ""<o:p></o:p>
<o:p></o:p>
Unload Me<o:p></o:p>
End Sub<o:p></o:p>
<o:p>
''''''''''''''''''''Set Print Area and print to A4'''''''''''''''''
Private Sub PrintAllA4_Click()<o:p></o:p>
Dim LastRow As Long<o:p></o:p>
Dim LastCol As Long<o:p></o:p>
<o:p></o:p>
With ActiveSheet<o:p></o:p>
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row<o:p></o:p>
LastCol = .Cells(2, .Columns.Count).End(xlToLeft).Column<o:p></o:p>
End With<o:p></o:p>
<o:p></o:p>
Range(Cells(1, 1), Cells(LastRow, LastCol)).Select<o:p></o:p>
ActiveSheet.PageSetup.PrintArea = Selection<o:p></o:p>
<o:p></o:p>
With ActiveSheet.PageSetup<o:p></o:p>
.PrintTitleRows = "$2:$2"<o:p></o:p>
.PrintTitleColumns = ""<o:p></o:p>
End With<o:p></o:p>
Application.PrintCommunication = True<o:p></o:p>
Application.PrintCommunication = False<o:p></o:p>
With ActiveSheet.PageSetup<o:p></o:p>
.PaperSize = xlPaperA4<o:p></o:p>
End With<o:p></o:p>



<o:p></o:p>
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _<o:p></o:p>
IgnorePrintAreas:=False<o:p></o:p>
ActiveSheet.PageSetup.PrintArea = ""<o:p></o:p>
Unload Me<o:p></o:p>
End Sub<o:p></o:p>

</o:p>


Regards
 
Last edited:

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
I think i might have found the solution to my problem - Application.PrintCommunication = True - should be added in front of the final print command.

The code should look like this -

Application.PrintCommunication = True
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _<O:P></O:P>
IgnorePrintAreas:=False

ActiveSheet.PageSetup.PrintArea = ""

 
Upvote 0

Forum statistics

Threads
1,215,666
Messages
6,126,106
Members
449,292
Latest member
Mario BR

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