View Single Post
 
Old 01-21-2018, 02:44 PM
thecastlingking thecastlingking is offline Windows 10 Office 2010 64bit
Novice
 
Join Date: Jan 2018
Posts: 3
thecastlingking is on a distinguished road
Smile Solution

I figured out why it prints like this. Firstly, in the for loop, intCount was = 1 instead of 0, that's why it was B&W for the first print. For the out of order, it's due to microsofts' background printing which backlogs the first batch. All I needed to do was disable that and now it works fine.

Here's the code now:

Sub MySerial()
Dim rngSerialLocation As Range
Dim intSerialNum As Integer
Dim strSerialNum As String
Dim docCurrent As Document
Dim intNumCopies As Integer
Dim intCount As Integer

' turn off microsoft's print-out organising tool
Options.PrintBackground = False
' set ref to current active doc
Set docCurrent = Application.ActiveDocument
' set ref to the bookmarked serial number
Set rngSerialLocation = docCurrent.Bookmarks("Serial").Range

' get the starting number
intSerialNum = Val(rngSerialLocation.Text)
' get the number of copies required
intNumCopies = Val(InputBox$("How many Copies?", _
"Print Serialized", "1"))

For intCount = 0 To intNumCopies
' print the document
docCurrent.PrintOut
' increment the serial number
intSerialNum = intSerialNum + 1
' put into formatted version
strSerialNum = Format(intSerialNum, "00000")
' stuff into proper place
rngSerialLocation.Text = strSerialNum
Next intCount

' reset the bookmark, since the updating procedure
' wipes out the old one
docCurrent.Bookmarks.Add Name:="Serial", _
Range:=rngSerialLocation
' turn on microsoft's print-out organising tool
Options.PrintBackground = True
End Sub
Reply With Quote