Numbering of Gift Certificates

A

Andy

I am trying to number gift certificates. I am using a
document with three cerficicates in it. I want the
number to incrument based on how many I print. EXAMPLE
if I print 10 pages I want the number to start at 4001,
4002, 4003 on page one and coutinue 4003, 4004, 4005 on
the second page and so no!
 
G

Greg Maxey

Andy,

I adapted the following macro from Doug Robbins article at
http://word.mvps.org/FAQs/MacrosVBA/NumberCopiesOf1Doc.htm

If you insert bookmarks SN1, SN2, and SN3 where you want
the certificate number to appear then run the macro, the
result should be what you need. Please run a small sample
first!

Sub Serialize()
Dim Message As String, Title As String, Default As String,
NumCopies As Long, StartNum As Long
Dim Rng1, Rng2, Rng3 As Range

Message1 = "Enter the number of pages that you want to
print"
Title1 = "Print"
Default1 = "1"
Message2 = "Enter the starting number"
Title2 = "Starting Number"
Default2 = "100"

NumCopies = Val(InputBox(Message1, Title1, Default1))
StartNum = Val(InputBox(Message2, Title2, Default2))

SN1 = StartNum
SN2 = StartNum + 1
SN3 = StartNum + 2

Set Rng1 = ActiveDocument.Bookmarks("SN1").Range
Set Rng2 = ActiveDocument.Bookmarks("SN2").Range
Set Rng3 = ActiveDocument.Bookmarks("SN3").Range

Counter = 0

While Counter < NumCopies
Rng1.Delete
Rng1.Text = SN1
Rng2.Delete
Rng2.Text = SN2
Rng3.Delete
Rng3.Text = SN3

ActiveDocument.PrintOut
SN1 = SN1 + 3
SN2 = SN2 + 3
SN3 = SN3 + 3
Counter = Counter + 1
Wend
With ActiveDocument.Bookmarks
.Add Name:="SN1", Range:=Rng1
.Add Name:="SN2", Range:=Rng2
.Add Name:="SN3", Range:=Rng3
End With
ActiveDocument.Save
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top