locked
Track how many times a Word 2007 file is printed RRS feed

  • Question

  • Hello,

    I have a Word 2007 file that I would like to track how many times it gets printed.

    When I open the file and print it I would like see printed on the hard copy the print count. So if I printed the file 5 times and I open and print for the 6th time, it should display 6 on the hard copy.

    Thanks...B 

    Update....I found the macro below and created a Bookmark to show number of prints.  However, is it possible to assoicate or call the macro when a user attempts to click on File>Print or clicks the Printer icon?

    When the macro runs a box appears prompting the user to enter number of "copies" to send to the printer.

    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

    • Edited by Bluem1 Wednesday, February 13, 2013 9:04 PM
    Wednesday, February 13, 2013 5:40 PM

All replies

  • Haven't been able to find a method to capture the number of print copies.

    How about add a macro button bind with your macro sample, and let the users print the document using the button instead?


    Max Meng
    TechNet Community Support

    Monday, February 18, 2013 2:49 PM
  • Haven't been able to find a method to capture the number of print copies.

    How about add a macro button bind with your macro sample, and let the users print the document using the button instead?


    Max Meng
    TechNet Community Support




    For what it's worth, that's exactly the approach recommended in the article at http://www.word.mvps.org/faqs/MacrosVBA/NumberCopiesOf1Doc.htm.

    Stefan Blom, Microsoft Word MVP

    Monday, February 18, 2013 3:08 PM
  • I can create a button and associate with the macro, but they prefer to not have the button showing on the document.

    I was hoping of to find a way to call the macro when a user attempts to click on File>Print or clicks printer icon.

    Thanks...B

    Thursday, February 21, 2013 4:09 PM
  • I was hoping of to find a way to call the macro when a user attempts to click on File>Print or clicks printer icon.

    Thanks...B





    In theory, you can do that by intercepting commands such as FilePrint, but this is less predictable and may not work at all in recent versions of Word.

    Stefan Blom, Microsoft Word MVP

    Thursday, February 21, 2013 4:37 PM