I feel this is likely a dup, but I can't find good answers and "Question's that may already have your answer" only shows an answer for excel.
I'm looking to track documents printed by having a serial number aka an incrementing number on each document printed.
The goal is that we have one document that is the master and then logs.
I want each log to have an incremental/unique number and then people can write that unique number on the master document for easy reference to the corresponding log.
I have been finding some complicated VBA, but I'm unfamiliar with adding VBA code to Word and that seems complicated, I figured word has a built in function for this that I am missing.
I want the field to look like this:
Doc #: 1
Next time we print it should show in the footer
Doc #: 2
etc etc.
Thank you,
PS: Office 2013 is currently what we use.
Print Serial Number or Icrementing Number in Word Document Footer
https://stackoverflow.com/questions/48909968/running-a-macro-before-printing-a-word-document
Best Answer
Seem's VBA is the way to go,
I have only found one solution that fits my problem and works.This was my final blog post --> https://www.freesoftwareservers.com/display/FREES/Adding+Serial+Number+or+Incremental+Number+to+Word+Document+at+Print+Time
Method 1: (This method makes the document portable, but doesn't have unique numbers for each document)
Serial_Numbered_Doc_Template.docm
First create a "Custom Document Property" named "Counter" and set the initial value to 0 (or whatever).
Insert into document where you want it to be when printed (CTRL + F9)
This module will increment the number by one each time the module is called:
Now I modified my "EventClassModule" to automatically call this sub when printing:
Method 2: (This method uses a file to track the serial number which has the advantage of have multiple word docs share the same settings/update log and each word doc should have a unique number)
I followed this guide found here -->
https://wordmvp.com/FAQs/MacrosVBA/NumberCopiesOf1Doc.htm
Of course the code posted on the site is incorrect...
The problem is it needs to have this code snippet:
Note the line
Dim SerialNumber As String
which is NOT on the website. Without it, you get the error found in this question >>https://stackoverflow.com/questions/48348049/vba-compile-error-expected-function-or-variable
For posterity, I will copy the guide here:
Also note, I made one other change which is that the site shows two places for "settings.txt", but one is "Settings.Txt" and the other is "Settings.txt". I switched it to "settings.txt" as I'm a Linux guy and know how caps and spaces etc can mess you up in the future.
------------------------------------------------`
Create a bookmark named
SerialNumber
in the document where you want the Serial Number to appear. It can be in the header or footer if that is where you want the number. Then create a macro containing the following commands to print the document.It will ask for the number of copies that you want to make and sequentially number each copy.The first time this macro runs, the first copy will be numbered 1 and when it finishes running, it will store in aSettings.Txt file the number that is one more that the number on the last copy.The next time the macro is run, it will start numbering the copies from that number. If when you first start, you want the numbers to start at some number other than 1, run the macro, entering 1 as the number of copies and then open Settings.Txt file and replace the number in the file with the number that you want as the first in the series.At any time thereafter, if you want the series to start at a particular number, you can open that file and replace the number in it with the number that you want to be the first in the series.
Note: You can/should probably change location of "settings.txt" to your LAN preferred location!
settings.txt