C
Code Numpty
I have the following macro which inserts sequential serial numbering in a
bookmark field and prints out automatically.
---------------------------------------------------------
Sub SEQserialnumber()
Dim Counter As Long
Dim NumCopies As Long
Dim Rng1 As Range
Dim SerialNumber As String
Dim Fld As Field
NumCopies = Val(InputBox("Enter the number of copies that you want to
print." _
& vbCr + vbCr & "Get it right you can't stop it!", "Print", "1"))
SerialNumber = Val(InputBox("Enter the starting SERIAL number", "Serial
Number", _
"0000001"))
ActiveDocument.Fields.Update
Set Rng1 = ActiveDocument.Bookmarks("SerialNumber").Range
Counter = 0
While Counter < NumCopies
Rng1.Delete
Rng1.Text = Format(SerialNumber, "000000#")
With ActiveDocument.Bookmarks
..Add Name:="SerialNumber", Range:=Rng1
End With
'For Each Fld In ActiveDocument.Fields
'If Fld.Type = wdFieldRef Then Fld.Update
'Next
ActiveDocument.PrintOut
SerialNumber = SerialNumber + 1
Counter = Counter + 1
Wend
ActiveDocument.Close SaveChanges:=False
End Sub
---------------------------------------------------------
I now need to add an additional bookmark for a Certificate Number to work in
the same way, starting from the user entered number and increasing by 1 for
every copy.
Is it possible to have the 2 in the same file? If so I'd be grateful for
some help with this.
bookmark field and prints out automatically.
---------------------------------------------------------
Sub SEQserialnumber()
Dim Counter As Long
Dim NumCopies As Long
Dim Rng1 As Range
Dim SerialNumber As String
Dim Fld As Field
NumCopies = Val(InputBox("Enter the number of copies that you want to
print." _
& vbCr + vbCr & "Get it right you can't stop it!", "Print", "1"))
SerialNumber = Val(InputBox("Enter the starting SERIAL number", "Serial
Number", _
"0000001"))
ActiveDocument.Fields.Update
Set Rng1 = ActiveDocument.Bookmarks("SerialNumber").Range
Counter = 0
While Counter < NumCopies
Rng1.Delete
Rng1.Text = Format(SerialNumber, "000000#")
With ActiveDocument.Bookmarks
..Add Name:="SerialNumber", Range:=Rng1
End With
'For Each Fld In ActiveDocument.Fields
'If Fld.Type = wdFieldRef Then Fld.Update
'Next
ActiveDocument.PrintOut
SerialNumber = SerialNumber + 1
Counter = Counter + 1
Wend
ActiveDocument.Close SaveChanges:=False
End Sub
---------------------------------------------------------
I now need to add an additional bookmark for a Certificate Number to work in
the same way, starting from the user entered number and increasing by 1 for
every copy.
Is it possible to have the 2 in the same file? If so I'd be grateful for
some help with this.