View Single Post
 
Old 08-20-2019, 08:23 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The following will add the data and the number with a leading zero

Code:
Sub PrintJobs()
Dim i As Long, startnum As Long, lastnum As Long
Dim orng As Range
    Set orng = ActiveDocument.SelectContentControlsByTitle("Serialnumber").Item(1).Range
    startnum = InputBox("Enter the first job number to be printed", "Print Job Number", 1)
    lastnum = InputBox("Enter the last job number to be printed", "Print Job Number", 1)
    For i = startnum To lastnum
        orng.Text = Format(Date, "mmyy") & Format(i, "00")
        ActiveDocument.PrintOut
    Next
    Set orng = Nothing
End Sub
Put the button on the QAT (Quick Access Toolbar) or on the ribbon Customize the Office Ribbon (It doesn't take rocket science)
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com

Last edited by gmayor; 08-21-2019 at 08:19 PM.
Reply With Quote