Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, and 2013. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Using Sequential Document Serial Numbers.

Using Sequential Document Serial Numbers

by Allen Wyatt
(last updated May 16, 2015)

10

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", _
      Range:=rngSerialLocation
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 (9540) applies to Microsoft Word 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Word here: Using Sequential Document Serial 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

Creating New Windows

A great way to work on different parts of the same document at the same time is to create windows. These function as ...

Discover More

ScreenTip for an Image

You can configure images in Excel so that if someone clicks on them, a macro is executed. You cannot, however, have a macro ...

Discover More

Using an Input Mask

When you are entering information in a worksheet, it sure would be handy to have a way to "mask" the information being ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More WordTips (ribbon)

Specifying a Paper Tray in a Macro

You may want to use a macro to process and then print your document. Part of that printing may involve specifying which of ...

Discover More

Transferring Fonts

Do you want to transfer fonts from one computer system to another? It is relatively easy to do, but there is one important ...

Discover More

Triple-Spacing Your Document

Print your document with lots of space between each line by triple spacing it! Here are some quick and easy steps for getting ...

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 seven less than 7?

2017-08-09 17:07:50

George

how do I write a template to be share on a network drive that has a sequential number?


2017-02-01 01:33:00

Dee

I cannot the serial number to appear on even the original doc/print. I am using MS 2016 on windows 10. Can somebody please help me...?


2016-09-30 16:04:53

Lance

This almost works, but for the fact it runs off 4 copies of each serial number. Help?


2016-09-30 10:14:06

Tina

I need to print multiple binders that consist of the same sheet (50 pages) in each binder. So I need to reset the numbering for each binder. How exactly do I do that?


2015-09-16 16:56:43

Frank Petermann

Brilliant, macro just saved the day as it's printing 700 sequential inspection sheets needed tomorrow morning!
Thanks much!


2015-08-11 11:48:36

Martin Steiner

Now I'm getting a message that while in debugger, it can't fine the project or Library and halts at "Format"


2015-08-11 11:22:50

Martin Steiner

Using Sequential Document Serial Numbers
updated May 16, 2015

I'm using Office 2010, win 7. I just cannot get this to work. The Serial bookmark works ok and I've tried many variation of adding and running the VBA scrip but no change in numbers and loads of paper with the same info one. After 6 hrs. I give up, how do I make this work?


2015-08-07 12:27:23

Matt Paulson

Hello!

How can I get the document to save it as a Word Document instead of a PDF? I need to run the Macro to get the new number and then send that sheet as a word document.

Thanks!


2015-06-16 16:19:16

Mike G

It seems that the serial is not moving up incrementally, as it only stays at "00001". How can I get the serial to change incrementally with each printing?


2015-05-19 17:18:29

Dennis Ralph

I have the same request but in Excel 2010.

I have to print out monthly pages of 1 - XX (depending on the amount of work load I encounter).
Is there a way to print out and number the pages sequentially without using the Header/Footer area? I have a cell at AQ4 that contains the page number. It's quite a waste of time to enter a number, print the page, increase the number be one, print that page, etc.
I have looked everywhere I can think of to attempt this feat! Even on ExcelTIPS!
Help would be muchly appreciated!
Cheers, Dennis


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu 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.