Auto Numbering

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to generate an invoice in either Word or Excel. I would like to
auto number the invoice so I don't have to manually change the number each
time I create the invoice.
 
I can't seem to make this work. I want my invoices to start with 1000. I
can get that number in there by using the macro. What makes the number
change to 1001, 1002 etc.?
 
To start with 1000, you need to make two changes. The first change is in
what the macro does when it hasn't been used before. Change the 1 to 1000
here:

If Order = "" Then
Order = 1000 ' <====
Else
Order = Order + 1
End If

After you make this change, delete the file C:\Settings.Txt if it exists, so
the sequence will start over.

The second change concerns the formatting of the numbers. The macro as-is
only allows for three-digit numbers, but you need four digits. Change the
two lines near the end to have three zeros before the # sign:

ActiveDocument.Bookmarks("Order").Range.InsertBefore Format(Order, "000#")
ActiveDocument.SaveAs FileName:="path" & Format(Order, "000#")
 
Back
Top