Please Note: This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Printing Copy Numbers.

Printing Copy Numbers

by Allen Wyatt
(last updated August 10, 2013)

7

In a business environment, it is not unusual to print multiple copies of a document. At times, it is beneficial to number the copies. For instance, the first copy would have (perhaps in a header or footer) the text "Copy 1," the second would have "Copy 2," on up to however many copies you have.

One option, of course, is to print the individual copies of the document, making the edits to the copy number between each print. This gets tedious, real fast. You may also want to utilize a sequential numbering field (as discussed in other WordTips) and make the number of copies equal to what you need to print. Thus, if you have to print 25 copies, you could simply copy the entire document (including the sequential numbering field), move to the end of the document, and paste it in another 24 times. This makes for a rather large overall document, however, and there are easier ways to approach the problem.

Perhaps the easiest solution to this problem (short of using a macro) is to simply use the mail-merge capabilities of Word. You would use a simple data source that contained the numbers you want assigned to each copy. Then, place the merge field at the appropriate place in y our document, and run the merge. Each copy will contain the desired copy number. The added benefit of using this approach is that you can use additional information with your merge, as needs dictate. For instance, if each copy of the document was assigned to a particular person, you could simply add another data field to your data source that contained the name of the person to receive the copy. Then, you could print that person's name in each merged document, as well.

If you prefer, you can use a macro to print out your numbered copies. For instance, the following macro asks you how many copies you want to print, along with the starting copy number to use. (This comes in real handy if you print 25 copies, and then someone asks you to print a second batch of 10, numbered 26 through 35.) The macro also stores the last copy number between sessions, so that it is used as the default when you next run the macro.

Public Sub PrintNumberedCopies1()
    Dim varItem As Variable
    Dim bExists As Boolean
    Dim lCopiesToPrint As Long
    Dim lCounter As Long
    Dim lCopyNumFrom As Long

    ' ensure our doc variable exists
    bExists = False
    For Each varItem In ActiveDocument.Variables
        If varItem.Name = "CopyNum" Then
            bExists = True
            Exit For
        End If
    Next varItem

    ' initialize document variable if doesn't exist
    If Not bExists Then
        ActiveDocument.Variables.Add _
            Name:="CopyNum", Value:=0
    End If

    ' ask how many to print
    lCopiesToPrint = InputBox( _
        Prompt:="How many copies?", _
        Title:="Print And Number Copies", _
        Default:="1")

    ' ask where to start numbering
    lCopyNumFrom = CLng(InputBox( _
        Prompt:="Number at which to start numbering copies?", _
        Title:="Print And Number Copies", _
        Default:=CStr(ActiveDocument.Variables("CopyNum") + 1)))

    ' loop through the print-write-print cycle
    For lCounter = 0 To lCopiesToPrint - 1
        ' update the document variable
        ActiveDocument.Variables("CopyNum") = _
            lCopyNumFrom + lCounter
        ' print this numbered copy
        ActiveDocument.PrintOut Copies:=1
    Next lCounter
End Sub

In order to use this macro, there are two other things you need to do. First, you need to indicate in your document where you want the copy number to appear. At the point where it should print, simply insert the following field (remember that you insert the field braces by pressing Ctrl+F9):

{ DOCVARIABLE "CopyNum" }

The second thing you need to do is make sure that Word is configured so that it updates fields when it prints. Now, when you run the macro, you are asked how many copies to print and what starting number to use. The document variable is updated and a single copy of the document is printed. These steps are repeated for the number of times that you chose to print.

Unfortunately, this macro solution will not work in all versions of Word. For instance, if you place the DOCVARIABLE field in the header of a Word 97 document and then print the document, Word will promptly crash.

How to get around this? Simply use a different approach. (Word is nothing, if not flexible.) The following macro works in all modern versions of Word. It is a variation of the earlier one that relies on the use of custom document properties instead of document variables.

Public Sub PrintNumberedCopies2()
    Dim varItem As DocumentProperty
    Dim bExists As Boolean
    Dim lCopiesToPrint As Long
    Dim lCounter As Long
    Dim lCopyNumFrom As Long

    ' ensure our doc variable exists
    bExists = False
    For Each varItem In ActiveDocument.CustomDocumentProperties
        If varItem.Name = "CopyNum" Then
            bExists = True
            Exit For
        End If
    Next varItem

    ' initialize document variable if doesn't exist
    If Not bExists Then
        ActiveDocument.CustomDocumentProperties.Add _
            Name:="CopyNum", LinkToContent:=False, _
            Type:=msoPropertyTypeNumber, Value:=0
    End If

    ' ask how many to print
    lCopiesToPrint = InputBox( _
        Prompt:="How many copies?", _
        Title:="Print And Number Copies", _
        Default:="1")

    ' ask where to start numbering
    lCopyNumFrom = CLng(InputBox( _
        Prompt:="Number at which to start numbering copies?", _
        Title:="Print And Number Copies", _
        Default:=CStr(ActiveDocument.CustomDocumentProperties("CopyNum") + 1)))

    ' loop through the print-write-print cycle
    For lCounter = 0 To lCopiesToPrint - 1
        ' update the document variable
        ActiveDocument.CustomDocumentProperties("CopyNum") = _
            lCopyNumFrom + lCounter
        ' print this numbered copy
        ActiveDocument.PrintOut Copies:=1
    Next lCounter
End Sub

In order to use this macro, there are two other things you need to do. First, you need to indicate in your document where you want the copy number to appear. At the point where it should print, simply insert the following field (remember that you insert the field braces by pressing Ctrl+F9):

{ DOCPROPERTY "CopyNum" }

When you first insert the field, you may see an error message returned by the field, such as "Error! Unknown document property name." Don't worry; this will go away and be replaced by the proper copy number after you run the macro.

The second thing you need to do is make sure that Word is configured so that it updates fields when it prints. Now, when you run the macro, you are asked how many copies to print and what starting number to use. The document variable is updated and a single copy of the document is printed. These steps are repeated for the number of times that you chose to print.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (844) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Printing Copy Numbers.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Printing Personalized Copies of a Document

Need to have a series of documents customized for individual users? Mail merge may be overkill, but the macro presented in ...

Discover More

Embedding TrueType Fonts by Default

If you use TrueType fonts frequently, you might want to set Word to embed those fonts by default. Here's how to do it.

Discover More

Printing Index Field Codes

Word allows you to configure what you see so that field codes are visible instead of the results of those field codes. ...

Discover More

Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!

More WordTips (menu)

Automatic Font Color Won't Print Properly

Imagine that you go to print your document, and all the text you can see on the screen just isn't there on the ...

Discover More

Adding a Diagonal Watermark with a PostScript Printer

If you have a printer that understands PostScript, you can add your own watermark to each printed page. This tip discloses ...

Discover More

Non-Printing Hyperlinks

Karen is having problems getting hyperlinks to print in a document on her home computer. There are only a limited number of ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 6 - 0?

2016-11-08 15:17:58

ikhwan Abid

MrBoss, Jack, Glen, Rich:

Yes I have the same issue you had. But I found fix.

Solution 1: Enable auto update link from options of your word. Follow the below steps:
1. Select 'File'
2. Select 'Options'
3. Select 'Advanced'
4. Scroll down till reach title 'Print'
5. Select the box named 'Allow fields containing tracked changes to update before printing'
6. Click ok and start printing

Solution 2:
1. Delete everything under 'loop through the print-write-print cycle,

2. And paste the following code into the original VB code above
' loop through the print-write-print cycle
For lCounter = 0 To lCopiesToPrint - 1
' update the document variable
ActiveDocument.CustomDocumentProperties("CopyNum") = _
lCopyNumFrom + lCounter
With Options
.UpdateFieldsAtPrint = True
.UpdateLinksAtPrint = True
End With
ActiveDocument.Fields.Update
' print this numbered copy
ActiveDocument.PrintOut Copies:=1
Next lCounter
End Sub


--------------------------------
I am a newbee with Macros, but hope this helps you.
___________________________________






2016-08-03 18:00:03

Sarah

Is there a way two run two of these on the same document?
I couldn't come up with it - I print some documents side by side and then cut the page so I need 2 different numbers on each page.


2016-08-01 19:28:07

MrBoss

Works perfectly on older version of MS word, but doesn't show to up MS word 2010


2014-12-10 11:16:46

Rich

Same here, The number does'nt show up using Word 2010 Any Ideas.


2014-10-27 11:11:28

Jack

I am having the same problem as Glenn, the number does not print.

Can you please advise if there is a error in the macro or if I am doing something wrong


2014-06-09 04:10:22

GLENN

THIS MACRO WORKS PERFECTLY.... BUT...

THE NUMBER THAT I ASSIGN DOES NOT SHOW UP WHEN I PRINT.

IS THERE A SETTING IN WORD THAT I NEED TO CHANGE?


2013-11-12 16:18:02

Adam

Is it possible to use this macro in Excel?


This Site

Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.