Code:
Option Explicit
Sub ElevatorInventoryControlTicket()
Dim iStart As Integer, iEnd As Integer, i As Integer
On Error GoTo ErrHandler
With ActiveDocument.Shapes(1).TextFrame.TextRange.Fields(1)
iStart = CInt(InputBox("What is the first certificate to print?", "Print Certificates From", Split(Split(.Code.Text, "")(0), "=")(1)))
iEnd = CInt(InputBox("What is the last Certificate to print?", "Print Certificates To", iStart))
If iStart = 0 Or iStart > iEnd Then Exit Sub
For i = iStart To iEnd
.Code.Text = "=" & i & " \#0"
.Update
ActiveDocument.PrintOut
Next
End With
ErrHandler:
End Sub
This is the code that I am using.