Code:
Private Sub cmdSubmit_Click()
Dim lngIndex As Long
Dim oRng As Word.Range
With ActiveDocument
.Bookmarks("NoOfBoxes").Range.Text = txtNoOfBoxes
.Bookmarks("YearClosed").Range.Text = txtYearClosed
.Bookmarks("CourtNumber").Range.Text = txtCourtNumber
.Bookmarks("CaseName").Range.Text = txtCaseName
.Sections.Add
For lngIndex = 1 To txtNoOfBoxes
Set oRng = ActiveDocument.Sections(2).Range
oRng.Collapse wdCollapseEnd
oRng.InsertBefore "Page " & lngIndex & " of " & txtNoOfBoxes
oRng.Collapse wdCollapseEnd
oRng.InsertBreak (wdPageBreak)
Next lngIndex
End With
Unload Me
lbl_Exit:
Exit Sub
End Sub
btw, as Paul suggested, you are not creating a template in VBA. Work.dotm is a template. You have created a rudimentary UserForm and with that Userform you are adding pages to the document created from Work.dotm