![]() |
|
#1
|
||||
|
||||
![]()
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
__________________
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. |
#2
|
|||
|
|||
![]()
Thank you very much Gmayor. That works perfectly. Thank you very much for your help.
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
4ener | Word | 9 | 02-24-2019 07:50 AM |
Sequential numbering in Word - Unique numbers for table rows | krips | Word | 1 | 03-21-2018 05:06 AM |
![]() |
srinivasaru | Excel Programming | 8 | 04-03-2017 12:53 PM |
![]() |
woodyear99 | Word | 1 | 07-18-2016 08:28 PM |
![]() |
atomtm | Word | 1 | 06-15-2012 05:39 AM |