A family of Microsoft word processing software products for creating web, email, and print documents.
You can do it with a couple of macros. Put the documents to be printed in a folder and run the macro 'BatchProcess'.
or to just print one create a macro with the line and run that with the document in question displayed in Word.
PrintToTrays ActiveDocument
Note that you will have to establish the tray IDs for trays 3 and 4 for the particular printer. The link in the function header below demonstrates how to do that. Substitute the numbers 260 and 261 with the actual numbers.
Function PrintToTrays(oDoc As Document)
Dim oRng As Range
Dim sTray As Long
'Set the tray ID's for the particular printer
'See http://www.gmayor.com/fax_from_word.htm
Const Tray3ID As Long = 261
Const Tray4ID As Long = 260
sTray = Options.DefaultTrayID
Options.DefaultTrayID = Tray3ID
oDoc.PrintOut Range:=wdPrintRangeOfPages, _
Copies:=1, _
Pages:="1", _
PageType:=wdPrintAllPages, _
Collate:=True, _
Background:=True, _
PrintToFile:=False, _
PrintZoomColumn:=0, _
PrintZoomRow:=0, _
PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
Set oRng = oDoc.Range
oRng.Start = oRng.End
If oRng.Information(wdActiveEndPageNumber) > 1 Then
Options.DefaultTrayID = Tray4ID
oDoc.PrintOut Range:=wdPrintRangeOfPages, _
Copies:=1, _
Pages:="2 - 999", _
PageType:=wdPrintAllPages, _
Collate:=True, _
Background:=True, _
PrintToFile:=False, _
PrintZoomColumn:=0, _
PrintZoomRow:=0, _
PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
End If
Options.DefaultTrayID = sTray
Application.Run MacroName:="SaveReminder.SavRemMain.RunSave"
Application.Run MacroName:="SaveReminder.SavRemMain.RunSave"
End Function
Sub BatchProcess()
Dim strFilename As String
Dim strPath As String
Dim oDoc As Document
Dim oLog As Document
Dim fDialog As FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.Title = "Select folder and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show <> -1 Then
MsgBox "Cancelled By User", , _
"List Folder Contents"
Exit Sub
End If
strPath = fDialog.SelectedItems.Item(1)
If Right(strPath, 1) <> "" _
Then strPath = strPath + ""
End With
If Documents.Count > 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
'Set oLog = Documents.Add
If Left(strPath, 1) = Chr(34) Then
strPath = Mid(strPath, 2, Len(strPath) - 2)
End If
strFilename = Dir$(strPath & "*.doc?")
While Len(strFilename) <> 0
WordBasic.DisableAutoMacros 1
Set oDoc = Documents.Open(strPath & strFilename)
'
'Do what you want with oDoc here
PrintToTrays oDoc
'record the name of the document processed
' oLog.Range.InsertAfter oDoc.FullName & vbCr
'
oDoc.Close SaveChanges:=wdDoNotSaveChanges
WordBasic.DisableAutoMacros 0
strFilename = Dir$()
Wend
End Sub