Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #16  
Old 04-21-2021, 05:43 AM
macropod's Avatar
macropod macropod is offline Sequential Numbering of Word Doc Windows 10 Sequential Numbering of Word Doc Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

See attached.



PS: When posting code, please use the code tags, indicated by the # button on the posting menu. Without them, your code loses much of whatever structure it had.
Attached Files
File Type: zip JHA Rev 14 Breight Tracked 1.zip (597.9 KB, 5 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #17  
Old 04-21-2021, 04:30 PM
Guessed's Avatar
Guessed Guessed is offline Sequential Numbering of Word Doc Windows 10 Sequential Numbering of Word Doc Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,969
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I think it is easier to deal with Content Controls so I would do this with the following code after putting a Content Control titled "CertNumber" in the location you want the number to appear.
Code:
Sub JHA_Print()
  Dim iStart As Integer, iEnd As Integer, i As Integer, aCC As ContentControl, sVal As String
  'On Error GoTo ErrHandler
  Set aCC = ActiveDocument.SelectContentControlsByTitle("CertNumber")(1)
  sVal = aCC.Range.Text
  If Not IsNumeric(sVal) Then
    iStart = 1
  Else
    iStart = CInt(sVal) + 1
  End If
  iEnd = CInt(InputBox("What is the last Certificate to print?", "Print Certificates To", iStart + 1))
  If iStart > iEnd Then Exit Sub
  With ActiveDocument
    For i = iStart To iEnd
      aCC.Range.Text = i
      .PrintOut
    Next
  End With
'ErrHandler:
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #18  
Old 04-21-2021, 07:43 PM
Charles Kenyon Charles Kenyon is offline Sequential Numbering of Word Doc Windows 10 Sequential Numbering of Word Doc Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,125
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

I get that you really, really, really, want to do this yourself, but take a look at:
Reply With Quote
  #19  
Old 05-08-2021, 08:03 PM
Onison Onison is offline Sequential Numbering of Word Doc Windows 10 Sequential Numbering of Word Doc Office 2016
Novice
Sequential Numbering of Word Doc
 
Join Date: Apr 2021
Posts: 9
Onison is on a distinguished road
Default

Hello Paul, sorry for dropping off of the radar, my wife got sick and I had to fly home for a couple of weeks.
I just wanted to let you know I have managed to get the file you sent through to me working (when I first tried to run the macro it told me the macros were disabled and would not work, I figured out I needed to have the file in a trusted location for it to run), it is now doing exactly what I need it to do. Thanks for your help and patience.

James
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sequential numbering in Word - Unique numbers for table rows krips Word 1 03-21-2018 05:06 AM
Sequential numbering within Word Earthly Way Word VBA 1 12-02-2015 07:36 PM
New to Word VBA - Sequential Numbering techmendz Word VBA 11 08-07-2014 08:20 AM
Sequential Numbering of Word Doc Sequential Numbering jdwoods Word VBA 7 12-16-2011 05:11 AM
Sequential Numbering of Word Doc Sequential Page Numbering of Multiple Word Docs bobmard Word 8 08-24-2011 08:51 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:21 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