Henry Babauta said:
My apologies for the long subject line; it's essentially exactly what I am
looking for. I copied the example of the macro offered on the MVP site to
sequentially number a document and it worked perfectly-I've been tasked
with
printing out 3,000 of them. The document will be used for Property
Management (inventory)control, but now they would like the form printed
out
in duplicate, on carbonless copy paper. Is there a VBA string that I
could
apply to the sequential numbering to duplicate a copy of each number?
Thanks very much in advance for any help with this.
Hi Henry
Not sure what macro you're using, but here is a macro by Doug Robbins, that
I modified to do what you want.
Good luck
Harold
****************************************************************************************************************************
Option Explicit
Sub DuplicateSerialNumber()
'===============================================================================================================
' Create a bookmark named "SerialNumber" in the document where you want the
Serial Number to appear.
' It can be in the header or footer if that is where you want the number.
Then create a macro containing the
' following commands to print the document.
' It will ask for the number of copies that you want to make and
sequentially number each copy.
' The first time this macro runs, the first copy will be numbered 1 and when
it finishes running,
' it will store in aSettings.Txt file the number that is one more that the
number on the last copy.
' The next time the macro is run, it will start numbering the copies from
that number. If when you first start,
' you want the numbers to start at some number other than 1, run the macro,
entering 1 as the number of copies
' and then open Settings.Txt file and replace the number in the file with
the number that you want as the first
' in the series.At any time thereafter, if you want the series to start at a
particular number,
' you can open that file and replace the number in it with the number that
you want to be the first in the series.
'If you want the Serial Number to appear in a particular format, e.g. 001,
002, etc, replace the line
'
'Rng1.Text = SerialNumber
'
'with
'
'Rng1.Text = Format(SerialNumber, "00#")
'================================================================================================================
Dim SerialNumber As String, Counter As Long
Dim Message As String, Title As String, Default As String, NumCopies As
Long
Dim Rng1 As Range
Dim i As Long
' Set prompt.
Message = "Enter the number of copies that you want to print"
' Set title.
Title = "Print"
' Set default.
Default = "1"
' Display message, title, and default value.
NumCopies = Val(InputBox(Message, Title, Default))
SerialNumber = System.PrivateProfileString("C:\Settings.Txt", _
"MacroSettings", "SerialNumber")
If SerialNumber = "" Then
SerialNumber = 1
End If
Set Rng1 = ActiveDocument.Bookmarks("SerialNumber").Range
Counter = 0
While Counter < NumCopies
For i = 0 To 1
Rng1.Delete
Rng1.Text = SerialNumber
ActiveDocument.PrintOut
Next
SerialNumber = SerialNumber + 1
Counter = Counter + 1
Wend
'Save the next number back to the Settings.txt file ready for the next use.
System.PrivateProfileString("C:\Settings.txt", "MacroSettings", _
"SerialNumber") = SerialNumber
'Recreate the bookmark ready for the next use.
With ActiveDocument.Bookmarks
.Add Name:="SerialNumber", Range:=Rng1
End With
ActiveDocument.Save
End Sub
****************************************************************************************************************************