invoice numbering

P

Pam

Using Word2003 and a script I found at the Microsoft site. I have
absolutely no experience with VB script but I inserted this script for
numbering invoices and it worked fine. The script is here, called AutoNew:
http://support.microsoft.com/default.aspx?scid=kb;en-us;212686

What I need to do is have the starting number something besides the default
of '1'. I went into the script and changed the iDefault = 1, but obviously
I need to change something else somewhere. Any help appreciated very much.

Also, is there a general Word help forum here? The ones I have found are
all specific - VB, forms, mail, etc.

Thanks in advance,

Pam
 
D

Doug Robbins

See the article "Creating sequentially numbered documents (such as
invoices)" at:

http://word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm

In that method, before you first use it, you can change the 1 in the
following

If Order = "" Then
Order = 1
Else

to the desired starting number, or else open the Settings.txt file and
change the number in there to one less than the number of the next invoice
that you want to create.


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
P

Pam

Doug, thanks for the help and that works great. However, every time I open
a new document based on that template, it creates a template in the template
folder called 'Path5101' or whatever the next number is. This could fill up
this folder very quickly. Am I missing something here?
Pam
 
P

Pam

Doug,
I just went back and looked at the code and removed the line that said to
automatically save the document with the invoice number. I removed that
line and it works perfectly.
Thanks for your help,
Pam
 
R

Ron Weaver

Doug
I am also interested in this topic. Is there any way to reset the numbers
without having to re-create the document? I saw your advise on amending the
the Text File but ,sorry to say, I can't figure out how to do it. Can you
help me with this? Thanks for any help.
Ron
 
D

Doug Robbins

The following will make it easy for you:

Dim Msg, Style, Title, Response, Default, Order
Order = System.PrivateProfileString("C:\Settings.Txt", "MacroSettings",
"Order")

If Order = "" Then
Order = 1
Else
Order = Order + 1
End If

Msg = "The Starting Number will be " & Order & ". Do you wish to change
it?" ' Define message.
Style = vbYesNo + vbQuestion + vbDefaultButton2 ' Define buttons.
Title = "Invoice Numbering" ' Define title.
' Display message.
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes.
Msg = "Enter the new Starting Number" ' Set prompt.
Title = "Invoice Numbering" ' Set title.
Default = Order ' Set default.
' Display message, title, and default value.
Order = InputBox(Msg, Title, Default)
End If

System.PrivateProfileString("C:\Settings.txt", "MacroSettings", _
"Order") = Order

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


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
R

Ron Weaver

This is great! Thanks so much for your help.
Ron
Doug Robbins said:
The following will make it easy for you:

Dim Msg, Style, Title, Response, Default, Order
Order = System.PrivateProfileString("C:\Settings.Txt", "MacroSettings",
"Order")

If Order = "" Then
Order = 1
Else
Order = Order + 1
End If

Msg = "The Starting Number will be " & Order & ". Do you wish to change
it?" ' Define message.
Style = vbYesNo + vbQuestion + vbDefaultButton2 ' Define buttons.
Title = "Invoice Numbering" ' Define title.
' Display message.
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes.
Msg = "Enter the new Starting Number" ' Set prompt.
Title = "Invoice Numbering" ' Set title.
Default = Order ' Set default.
' Display message, title, and default value.
Order = InputBox(Msg, Title, Default)
End If

System.PrivateProfileString("C:\Settings.txt", "MacroSettings", _
"Order") = Order

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


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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