M
Mable
Hello all,
I've been developing a macro to print out documents to
seperate trays of a printer, based upon the contents of
each page. I've come up with a solution that works when
tested upon my HP LaserJet 4500. However, the people I
have been constructing this macro for require it to be
used on a Xerox Docuprint machine. The Xerox machine has
its own software which specifies how each job is printed
based upon the computer from which it is sent.
Does anyone know how it would be possible for my macro to
override the Xerox's settings? I've included the macro's
code.
Sub SortPrintTrays()
'Gets page count
Dim intPages As Integer
intPages = ActiveDocument.BuiltInDocumentProperties
(wdPropertyPages)
'Creates placeholder for White characters
Dim s As String
'Custom Function, clears any previous search settings
Resetsearch
'Creates variable for the entire document
Dim oRng As Range
Documents("Document1").Activate
Set oRng = ActiveDocument.Range
'Sorting FOR Loop, finds each White character and prints
page accordingly
For Sort = 1 To intPages
With oRng.Find
.ClearFormatting
.Font.Color = wdColorBlack
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
oRng.Find.Execute
s = oRng.Text
ActiveDocument.Bookmarks("\Page").Select
oRng.Collapse direction:=wdCollapseEnd
oRng.Select
If s = 1 Then
Options.DefaultTrayID = 256 ' Tray 1
ActiveDocument.PrintOut Range:=wdPrintCurrentPage
Else
Options.DefaultTrayID = 258 ' Tray 2
ActiveDocument.PrintOut Range:=wdPrintCurrentPage
End If
oRng.End = ActiveDocument.Range.End
End With
Next Sort
End Sub
I've been developing a macro to print out documents to
seperate trays of a printer, based upon the contents of
each page. I've come up with a solution that works when
tested upon my HP LaserJet 4500. However, the people I
have been constructing this macro for require it to be
used on a Xerox Docuprint machine. The Xerox machine has
its own software which specifies how each job is printed
based upon the computer from which it is sent.
Does anyone know how it would be possible for my macro to
override the Xerox's settings? I've included the macro's
code.
Sub SortPrintTrays()
'Gets page count
Dim intPages As Integer
intPages = ActiveDocument.BuiltInDocumentProperties
(wdPropertyPages)
'Creates placeholder for White characters
Dim s As String
'Custom Function, clears any previous search settings
Resetsearch
'Creates variable for the entire document
Dim oRng As Range
Documents("Document1").Activate
Set oRng = ActiveDocument.Range
'Sorting FOR Loop, finds each White character and prints
page accordingly
For Sort = 1 To intPages
With oRng.Find
.ClearFormatting
.Font.Color = wdColorBlack
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
oRng.Find.Execute
s = oRng.Text
ActiveDocument.Bookmarks("\Page").Select
oRng.Collapse direction:=wdCollapseEnd
oRng.Select
If s = 1 Then
Options.DefaultTrayID = 256 ' Tray 1
ActiveDocument.PrintOut Range:=wdPrintCurrentPage
Else
Options.DefaultTrayID = 258 ' Tray 2
ActiveDocument.PrintOut Range:=wdPrintCurrentPage
End If
oRng.End = ActiveDocument.Range.End
End With
Next Sort
End Sub