Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-17-2020, 02:54 AM
Just Learning Just Learning is offline Another Question About Sequential Numbering Windows 10 Another Question About Sequential Numbering Office 2019
Novice
Another Question About Sequential Numbering
 
Join Date: Mar 2020
Posts: 7
Just Learning is on a distinguished road
Default Another Question About Sequential Numbering

I was looking for a macro on sequential Numbering and came across this code on one of the threads.

I would like to adapt this code by changing the input boxes to read from a userform text boxes, place it in a bookmark and also add the provision to print multiple copies of one document?

Thankyou.


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))
If iStart = 0 Or iStart > iEnd Then Exit Sub
With ActiveDocument
  For i = iStart To iEnd
    With .Shapes(1).TextFrame.TextRange.Fields(1)
      StrArry = Split(.Code.Text, " ")
      .Code.Text = Replace(.Code.Text, StrArry(UBound(StrArry)), i)
      .Update
    End With
    .PrintOut
  Next
End With
ErrHandler:
End Sub


Last edited by macropod; 03-17-2020 at 10:07 PM. Reason: Added code tags
Reply With Quote
  #2  
Old 03-17-2020, 05:33 AM
gmayor's Avatar
gmayor gmayor is offline Another Question About Sequential Numbering Windows 10 Another Question About Sequential Numbering Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
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

See Auto number documents
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 03-17-2020, 06:58 AM
Just Learning Just Learning is offline Another Question About Sequential Numbering Windows 10 Another Question About Sequential Numbering Office 2019
Novice
Another Question About Sequential Numbering
 
Join Date: Mar 2020
Posts: 7
Just Learning is on a distinguished road
Default

Thanks Graham for your reply.

Yes I have seen auto number documents on your website. thanks for the tips on the website.
I have got it to work with input boxes rather than a user form using text boxes and only starting at one to... however, when I print the document with multiple copies it prints from doc 12 and a few random numbers and then in sequence. I tried in the printer properties advanced setting to change it to "Start printing after last page is spooled" with no luck. is there a work around by delaying the print or something else?
Reply With Quote
  #4  
Old 03-17-2020, 08:39 AM
gmayor's Avatar
gmayor gmayor is offline Another Question About Sequential Numbering Windows 10 Another Question About Sequential Numbering Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
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

You can turn off background printing from Word's Options,
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #5  
Old 03-17-2020, 09:34 AM
Just Learning Just Learning is offline Another Question About Sequential Numbering Windows 10 Another Question About Sequential Numbering Office 2019
Novice
Another Question About Sequential Numbering
 
Join Date: Mar 2020
Posts: 7
Just Learning is on a distinguished road
Default

Thank you for a simple but very effective one line piece of advice.

Works perfectly.
Reply With Quote
  #6  
Old 03-17-2020, 09:41 PM
gmayor's Avatar
gmayor gmayor is offline Another Question About Sequential Numbering Windows 10 Another Question About Sequential Numbering Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
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

Given that worked for you, note that you can turn it off from your code and turn it back on again after it has finished e.g.
Code:
   Options.PrintBackground = False
    'your code here
   Options.PrintBackground = True
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #7  
Old 03-18-2020, 08:13 PM
Just Learning Just Learning is offline Another Question About Sequential Numbering Windows 10 Another Question About Sequential Numbering Office 2019
Novice
Another Question About Sequential Numbering
 
Join Date: Mar 2020
Posts: 7
Just Learning is on a distinguished road
Default

Once again thanks Graham.



I will give it a go.


Update....Simpler and simpler each time.Awesome.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Another Question About Sequential Numbering How do I do a Sequential Numbering? gburya Word VBA 26 07-04-2017 03:29 PM
Another Sequential Numbering Question (1,2,3a,3b,3c,4,5,6) highrise955 Word VBA 4 03-21-2016 04:24 AM
Another Question About Sequential Numbering Sequential Print Numbering RetailPoint Word VBA 14 01-14-2015 09:51 AM
Another Question About Sequential Numbering Sequential page numbering im_rusahbh Word VBA 1 12-23-2013 05:28 PM
Another Question About Sequential Numbering Sequential Numbering jdwoods Word VBA 7 12-16-2011 05:11 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:05 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft