Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-23-2022, 05:34 AM
Ian_WB Ian_WB is offline Printing different sections of a document from different printer trays Windows 11 Printing different sections of a document from different printer trays Office 2013
Novice
Printing different sections of a document from different printer trays
 
Join Date: May 2022
Posts: 1
Ian_WB is on a distinguished road
Default Printing different sections of a document from different printer trays

Hi,

I need to be able to print the first section of a word document from one tray, but the rest of the sections from another tray. I have managed to do this on a document that we know how many sections. I have tried to do this, but the first 2 sections come out from one tray and the third from the different tray.

Any ideas where I may have gone wrong? This is my macro:

Sub Section()
'
' Section Macro
'
'
With Selection.PageSetup
.FirstPageTray = wdPrinterLowerBin
.OtherPagesTray = wdPrinterLowerBin
Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _


wdPrintDocumentWithMarkup, Copies:=1, Pages:="S1", PageType:= _
wdPrintAllPages, Collate:=True, Background:=True, PrintToFile:=False, _
PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
End With
With Selection.PageSetup
.FirstPageTray = wdPrinterMiddleBin
.OtherPagesTray = wdPrinterMiddleBin
Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _
wdPrintDocumentWithMarkup, Copies:=1, Pages:="S2-S10", PageType:= _
wdPrintAllPages, Collate:=True, Background:=True, PrintToFile:=False, _
PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
End With
End Sub

Thanks
Ian
Reply With Quote
  #2  
Old 05-23-2022, 04:11 PM
Guessed's Avatar
Guessed Guessed is offline Printing different sections of a document from different printer trays Windows 10 Printing different sections of a document from different printer trays Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Your code is applying the trays to the selection rather than the document as a whole. Try this variation to make the trays independent of the selection when you run the macro.
Code:
Sub Section()
  With ActiveDocument.PageSetup
    .FirstPageTray = wdPrinterLowerBin
    .OtherPagesTray = wdPrinterMiddleBin
  End With
  If ActiveDocument.Sections.Count > 9 Then
    Application.PrintOut Range:=wdPrintRangeOfPages, Item:=wdPrintDocumentWithMarkup, Copies:=1, Pages:="S1-S10", _
          PageType:=wdPrintAllPages, Collate:=True
  Else
    Application.PrintOut Range:=wdPrintAllDocument, Item:=wdPrintDocumentWithMarkup, Copies:=1, _
          PageType:=wdPrintAllPages, Collate:=True
  End If
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing different sections of a document from different printer trays Print to Multiple Printer Trays...and Printers RMittelman Word VBA 4 01-02-2020 05:09 PM
Printing different sections of a document from different printer trays Printing a document with multiple sections with different headers and footers Finster Word 2 01-09-2019 07:13 AM
Printing - merged document, multiple sections nikkifox Word 2 04-09-2013 12:54 AM
Printing Sections of a Word Document Andy Jenkinson Word 4 02-12-2010 02:53 AM
Document with selective sections printing krismason Word 0 07-09-2009 03:30 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:51 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft