Auto Numbering

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.
 
G

Guest

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.?
 
J

Jay Freedman

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#")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top