Word.Tips.Net WordTips (Menu Interface)

Using Sequential Document Serial Numbers

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: Using Sequential Document Serial Numbers.

If you have a need to create serial numbers in your documents and they are very simple in nature, you can do so using a macro. This approach to serial numbers is great if your serial numbers are sequential (1, 2, 3, etc.) or regular in their incidence (3, 5, 7, etc.).

To begin, you should enter the macro that will control the change of the serial number and the printing of your document. You can use the following macro:

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", _
End Sub

There is only one prerequisite to using the macro: you need to make sure that your document contains a bookmark named Serial. This bookmark should reference the serial number in your document, as you want it to appear in the first printed document. (When you are through running the macro, you can save the document and the serial number will be ready for the next time you want to use it.)

The macro also assumes that your serial number consists primarily of some numeric value that changes with each iteration. You can modify the incrementing of the serial number, as well as its formatting, in the For...Next loop within the macro.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (1747) 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: Using Sequential Document Serial Numbers.

Related Tips:

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!


Leave your own comment:

  Notify me about new comments ONLY FOR THIS TIP
Notify me about new comments ANYWHERE ON THIS SITE
Hide my email address
*What is 5+3 (To prevent automated submissions and spam.)
           Commenting Terms

Comments for this tip:

Marshall Burke    26 Sep 2016, 09:44
Works great except for the automated printing output. Thank you. But how can I modify the macro code so that when I run the macro and increase the count by one, a copy of the previous numbered document is not printed. I do not want an automated printed copy and want to control that printing function in the normal way. I do want the serial number to increase by 1 when the macro is run.
John    01 Aug 2016, 15:54
Hi and thanks for the Tip.
Very interesting.
Is there a way to output all documents in a unique Pdf files please?

Thanks and Regards
Erich    09 Mar 2016, 09:14
Works awesome. Thanks.
Chir    07 Jul 2015, 14:39
Oh -- and Thank you Allen!
Chir    07 Jul 2015, 14:37
Hello everyone! This Macro seemed to work for me except for the fact that the macro is printing 2 copies of each iteration of the document I added the Macro to. I looked through the Macro to see if I could identify a line that was causing the duplication, but did not notice anything I could put my finger on.

Could this be because I am trying this on a multiple pages document? Has this happened to anyone else? If so, how did you fix this issue? Thanks!

Steve - Are you running the Macro to print the document or doing File- Print as you normally would? Running the Macro to print worked for me, except for the issue I mentioned in the paragraph above. (I'm noticing that your comment was posted in March-so perhaps this feedback is a tad bit untimely)
Amir    11 Jun 2015, 03:39
Awesome, when I run the macro, I get very nice result! thanks a lot!

I bookmarked a text as: Serial

as you have told.

Very Nice!
Steve    18 Mar 2015, 17:07
Try as I might, I cannot get the serial number to increment.

It may be the sequence and process for a) adding the macro and b) adding the bookmark.

A bookmark named Serial has been added. A single bracketed digit appears at the bottom right of the single page document: [1]

When opened, VB shows one macro named MySerial, flagged as (General).

The number prints, without the brackets, but does NOT increment. Could sure use this sometime today/tonight.


Patrick    06 Mar 2015, 18:36
We have been using this for a couple years when it suddenly stopped working and giving us an over flow error.

Figured out we had reached the limit of the Integer setting of -32,767 to 32,767 when our sequence reached 32767. Changed the dim listings from "Integer" to "Long" and all is good again.

Greatly appreciate this macro and the time it has saved us.
John K    13 Feb 2013, 16:08
This macro is exactly what I was looking for. However, is it possible to execute the macro when a users attempts to Click on File>Print or clicks the printer icon?
Roy Jensen    19 Sep 2012, 16:57
A workaround: put the serial number in the header or footer. This doesn't work if you have a different first page or non-continuous headers between sections.
Roy Jensen    19 Sep 2012, 00:31
I've got this to work, but I would like to print the serial number on EVERY PAGE of the document.

 * I've tried referencing the bookmark, but that doesn't work.
 * I've tried bookmarking the entire serial number, but that doesn't work.

Any ideas how to do this?

Geza    05 Sep 2012, 08:12
Hi Alan,
I managed to get help on this forum, you can read the whole thing here:


but if you only need the final result I can send it to you if you post your email address here (in the text area) making sure that you're using some dummy characters instead of "@" something like allan{at}abc.net, this way spam sending email address harvesting robots won't see it as an email address.

Allan    04 Sep 2012, 20:04
Hi Geza, I'm starting off too. I figured out that on the main document you need to click the "Bookmark" icon on the "insert" tab (Word2010). It will ask you a prompt word. You just type in the word "serial" then run it. Just remember to place the curser where you want the serial number to be placed before you bookmark it.

My issue is that it does not request the starting number, it just goes to how many copies...still trying to figure that out.
Geza    16 May 2012, 08:01
I get an Run-time error '5941':
The requested member of the collection doesn't exist.

Set rngSerialLocation = docCurrent.Bookmarks("Serial").Range

Can you help?

Our Company

Sharon Parq Associates, Inc.

About Tips.Net

Contact Us


Advertise with Us

Our Privacy Policy

Our Sites


Beauty and Style




DriveTips (Google Drive)

ExcelTips (Excel 97–2003)

ExcelTips (Excel 2007–2016)



Home Improvement

Money and Finances


Pests and Bugs

Pets and Animals

WindowsTips (Microsoft Windows)

WordTips (Word 97–2003)

WordTips (Word 2007–2016)

Our Products

Helpful E-books

Newsletter Archives


Excel Products

Word Products

Our Authors

Author Index

Write for Tips.Net

Copyright © 2017 Sharon Parq Associates, Inc.