Re: serial numbering
- From: grandpappajim <grandpappajim@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 19 Jul 2008 14:56:01 -0700
Thanks a lot Graham, I haven't had much exsperience with Macros so this is
going to be a bit of a learning curve.....Scary
Regards Jim
"Graham Mayor" wrote:
Just to clarify - you put a bookmark named "InvNo" at the place where you.
want the number to appear. The next available number is stored in the
settings file. The reset function is only to set either the start number or
to correct the count after making a ***-up!
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor wrote:
OK, a variation on the code on the first link will do that. Put a
bookmark at the place in your document where you want the invoice
number to be printed and run the following macro:
Sub AddNoFromINIFileToBookmark()
Dim SettingsFile As String
Dim Order As String
Dim iCount As String
Dim rInvNo As Range
Dim i As Long
iCount = InputBox("Print how many copies?", _
"Print Copies", 3)
If iCount = "" Then Exit Sub
SettingsFile = Options.DefaultFilePath(wdStartupPath) _
& "\Settings.ini"
Order = System.PrivateProfileString(SettingsFile, _
"InvoiceNumber", "Order")
If Order = "" Then
Order = 1
End If
For i = 1 To iCount
Set rInvNo = ActiveDocument.Bookmarks("InvNo").Range
rInvNo.Text = Format(Order, "00000")
With ActiveDocument
.Bookmarks.Add "InvNo", rInvNo
.Fields.Update
.ActiveWindow.View.ShowFieldCodes = False
.PrintOut
End With
Next
Order = Order + 1
System.PrivateProfileString(SettingsFile, "InvoiceNumber", _
"Order") = Order
End Sub
If you don't want the macro to prompt for the number of copies then
replace
iCount = InputBox("Print how many copies?", _
"Print Copies", 3)
If iCount = "" Then Exit Sub
with
iCount = 3
The next macro will allow you to reset the invoice number to the next
number of choice.
Sub ResetInvoiceNo()
Dim SettingsFile As String
Dim Order As String
Dim sQuery As String
SettingsFile = Options.DefaultFilePath(wdStartupPath) &
"\Settings.ini"
Order = System.PrivateProfileString(SettingsFile, _
"InvoiceNumber", "Order")
sQuery = InputBox("Reset invoice start number?", "Reset", Order)
If sQuery = "" Then Exit Sub
Order = sQuery
System.PrivateProfileString(SettingsFile, "InvoiceNumber", _
"Order") = Order
End Sub
http://www.gmayor.com/installing_macro.htm
grandpappajim wrote:
I intend to print the three parts seperately Graham.
"Graham Mayor" wrote:
Are you printing the three parts separately, or are you using an
impact printer to print all three together?
See http://www.gmayor.com/automatic_numbering_documents.htm and
http://www.gmayor.com/Numbered_labels.htm for some techniques.
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
grandpappajim wrote:
I want to print a batch of three part NCR invoices. how do I get
the serial numbers to enter automaticaly?
- Follow-Ups:
- Re: serial numbering
- From: Graham Mayor
- Re: serial numbering
- References:
- Re: serial numbering
- From: Graham Mayor
- Re: serial numbering
- From: Graham Mayor
- Re: serial numbering
- From: Graham Mayor
- Re: serial numbering
- Prev by Date: Re: check box
- Next by Date: Unexpected alignment when using styles for headings 1, 1.1, 1.1.1
- Previous by thread: Re: serial numbering
- Next by thread: Re: serial numbering
- Index(es):