I posted the following some time back for a similar application. It
essentially prints numbered certificates. What you do is insert a bookmark
in your pre-prepared certificate at the location where you want the number
to appear. Name the bookmark 'RecNo' (without the quotes). Then run the
macro 'ResetCertNo' to set the start number of the certificates (if other
than 00001). Then run the macro 'AddNoFromINIFileToBookmark' to print off as
many numbered certificates as you require. The last number is saved in an
ini file in your Word startup folder so next time you need numbered
certificates you can simply run the macro again - and if you make a mistake
you can reset the start number with the other macro.
Add the two macros to your certificate template and add a toolbar to contain
the two commands -
http://www.gmayor.com/installing_macro.htm
Sub AddNoFromINIFileToBookmark()
Dim SettingsFile As String
Dim Order As String
Dim iCount As String
Dim rRecNo As Range
Dim i As Long
iCount = InputBox("Print how many certificates?", _
"Print Certificates", 1)
If iCount = "" Then Exit Sub
SettingsFile = Options.DefaultFilePath(wdStartupPath) & "\Settings.ini"
Order = System.PrivateProfileString(SettingsFile, _
"CertNumber", "Order")
If Order = "" Then
Order = 1
End If
For i = 1 To iCount
Set rRecNo = ActiveDocument.Bookmarks("RecNo").Range
rRecNo.Text = Format(Order, "00000")
ActiveDocument.Bookmarks.Add "RecNo", rRecNo
ActiveDocument.PrintOut
Order = Order + 1
Next
System.PrivateProfileString(SettingsFile, "CertNumber", _
"Order") = Order
End Sub
Sub ResetCertNo()
Dim SettingsFile As String
Dim Order As String
Dim sQuery As String
SettingsFile = Options.DefaultFilePath(wdStartupPath) & "\Settings.ini"
'SettingsFile = Options.DefaultFilePath(wdWorkgroupTemplatesPath) & _
"\Settings.ini"
Order = System.PrivateProfileString(SettingsFile, _
"CertNumber", "Order")
sQuery = InputBox("Reset certificate start number?", "Reset", Order)
If sQuery = "" Then Exit Sub
Order = sQuery
System.PrivateProfileString(SettingsFile, "ReceiptNumber", _
"Order") = Order
End Sub
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>