Wrote this for a customer today, thought it might be of use to others. I started with this macro from http://www.cncci.com/resources/tips/serial%20macro.htm written by Steve Wood. We had some different requirements, so all that is left of his original program are the programs for the numbers, those have been edited as well. The pdf is a full description of how to call the program, simple G65 call.
The macro allows scaling of the numbers as well as changing the spacing, the option of leading zeros or not, and can cut any integer number up to the maximum allowed length of the variables on your machine. 8 digits on the Oi that I tested the program on.
Anyways, use as you wish.