View Single Post
 
Old 04-20-2021, 07:57 PM
Onison Onison is offline Windows 10 Office 2016
Novice
 
Join Date: Apr 2021
Posts: 9
Onison is on a distinguished road
Default

Hello Macropod, I have used the Macro from https://www.msofficeforums.com/word-...numbering.html you provided previously;

Code:
Sub CertificatePrint()
Dim iStart As Integer, iEnd As Integer, i As Integer, StrArry
On Error GoTo ErrHandler
iStart = CInt(InputBox("What is the first Certificate to print?", "Print Certificates From", "1"))
iEnd = CInt(InputBox("What is the last Certificate to print?", "Print Certificates To", iStart + 1))
If iStart = 0 Or iStart > iEnd Then Exit Sub
With ActiveDocument
  For i = iStart To iEnd Step 2
    With .Shapes(2).TextFrame.TextRange.Fields(2)
      StrArry = Split(.Code.Text, " ")
      .Code.Text = Replace(.Code.Text, StrArry(UBound(StrArry)), i)
      .Update
    End With
    With .Shapes(2).TextFrame.TextRange.Fields(2)
      StrArry = Split(.Code.Text, " ")
      .Code.Text = Replace(.Code.Text, StrArry(UBound(StrArry)), i + 1)
      .Update
    End With
    .PrintOut
  Next
End With
ErrHandler:
End Sub

I manage to get as far as the dialogue box asking me the first & last numbers to print, but the number does not populate in the text box I want it to, or any other for that matter. Also, once the range has been selected it does not send the document to the printer.
Reply With Quote