Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-16-2014, 06:06 AM
Mark Paterson Mark Paterson is offline Sequentially numbered copies of multi-page word document Windows 7 64bit Sequentially numbered copies of multi-page word document Office 2007
Novice
Sequentially numbered copies of multi-page word document
 
Join Date: May 2014
Location: Kingston Ontario Canada
Posts: 2
Mark Paterson is on a distinguished road
Default Sequentially numbered copies of multi-page word document

I have a 25 page Word 2007 document that requires the serial number to appear on each page. Is it possible to bookmark each location to have a sequential serial number auto generate for each printed copy? We are currently stamping the serial number on each page of the inspection record. I found the following Macro but it only picks up the first bookmark.
Code:
Sub MySerial() 
    Dim rngSerialLocation As Range 
    Dim intSerialNum As Integer 
    Dim strSerialNum As String 
    Dim docCurrent As Document 
    Dim intNumCopies As Integer 
    Dim intCount As Integer 
     
     ' set ref to current active doc
    Set docCurrent = Application.ActiveDocument 
     ' set ref to the bookmarked serial number
    Set rngSerialLocation = docCurrent.Bookmarks("Serial").Range 
     
     ' get the starting number
    intSerialNum = Val(rngSerialLocation.Text) 
     ' get the number of copies required
    intNumCopies = Val(InputBox$("How many Copies?", _ 
    "Print Serialized", "1")) 
     
    For intCount = 1 To intNumCopies 
         ' print the document
        docCurrent.PrintOut Range:=wdPrintAllDocument 
         ' increment the serial number
        intSerialNum = intSerialNum + 1 
         ' put into formatted version
        strSerialNum = Format(intSerialNum, "00000") 
         ' stuff into proper place
        rngSerialLocation.Text = strSerialNum 
    Next intCount 
     
     ' reset the bookmark, since the updating procedure
     ' wipes out the old one
    docCurrent.Bookmarks.Add Name:="Serial", _ 
    Range:=rngSerialLocation 
End Sub


Last edited by macropod; 05-16-2014 at 04:06 PM. Reason: Added code tags & formatting
Reply With Quote
 

Tags
auto numbering

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sequentially numbered copies of multi-page word document Continuous Page Numbers with Multi-sectioned document are not working. Morningside Word 4 05-19-2014 01:18 PM
Sequentially numbered copies of multi-page word document Sequentially numbering a document UniAdmin Word VBA 1 02-21-2013 07:25 PM
Sequentially numbered copies of multi-page word document Insert multi page pdf into Word 2010 document TimTDP Word 1 04-18-2012 04:22 AM
Sequentially numbered copies of multi-page word document Multiple sequentialy numbered copies of one page Roger1941 Word VBA 1 01-24-2011 03:26 PM
varying orientation on a multi-page document??? imimin Word 1 08-24-2009 12:12 PM

Other Forums: Access Forums

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