Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-23-2019, 12:19 PM
craznbran craznbran is offline Employ a single document in Word that will automatically insert sequential numbers in desired area Windows 10 Employ a single document in Word that will automatically insert sequential numbers in desired area Office 2010
Novice
Employ a single document in Word that will automatically insert sequential numbers in desired area
 
Join Date: Sep 2019
Posts: 2
craznbran is on a distinguished road
Cool Employ a single document in Word that will automatically insert sequential numbers in desired area

I have tried everything. Forum after forum after video after dummy self help and I cannot seem to figure it out. I need to be able to print a single document x30 at a time where my PO# 1XXXX will automatically update sequentially. I have also read several forums on this website & I cannot seem to get my dang document to do what I need it to do. I have added a macro to my document, I have "ran" it... and nothing. I've even looked up Dummies guide to VBA & macros and I cannot seem to understand what it is that I am doing wrong...



My template is already made out & I have the following Macro tied/saved to my document. My guess is, that in the macro, I am not telling it correctly where to pull the number from to start the 1st sequential order. Once I can figure it out, I will be using this document as a base template & will need to copy/save as new for other PO# types for various suppliers we use. So as user friendly as possible so that others on my team can update the PO# & print as well. I am on the most updated version of Microsoft Word for Office 365 MSO 64-bit. Please save me from insanity
Code:
Option Explicit

Sub CertificatePrint()
Dim iStart As Integer, iEnd As Integer, i As Integer
On Error GoTo ErrHandler
With ActiveDocument.Shapes(1).TextFrame.TextRange.Fields(1)
  iStart = CInt(InputBox("What is the first Certificate to print?", _
      "Print Certificates From", Split(Split(.Code.Text, " ")(0), "=")(1)))
  iEnd = CInt(InputBox("What is the last Certificate to print?", _
      "Print Certificates To", iStart))
  If iStart = 0 Or iStart > iEnd Then Exit Sub
  For i = iStart To iEnd
    If i = iStart Then
      With Application.Dialogs(wdDialogFilePrint)
        If .Show = 0 Then Exit Sub
      End With
    End If
    .Code.Text = "=" & i & " \# 0"
    .Update
    ActiveDocument.PrintOut
  Next
End With
ErrHandler:
End Sub

Last edited by macropod; 10-23-2019 at 09:58 PM. Reason: Added code tags
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Having Word print sequential serial numbers in a text field limdul9992 Word VBA 5 08-21-2019 06:23 AM
with different area of blocks, can we arrange automatically in a big rectangle area, Optimally oneeyeevil Excel Programming 0 06-21-2019 03:45 AM
Sequential numbering in Word - Unique numbers for table rows krips Word 1 03-21-2018 05:06 AM
Automatically generate formulas from just the row numbers (auto insert the column) knewman Excel 14 04-25-2017 11:54 PM
Employ a single document in Word that will automatically insert sequential numbers in desired area How to have sequential numbers appear in word header woodyear99 Word 1 07-18-2016 08:28 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:35 PM.


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