View Single Post
  #15   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default print receipts with running number without creating many pages

You are welcome

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


jaysan3 wrote:
Thanks very much, Graham. It works like a charm.

"Graham Mayor" wrote:

Graham Mayor wrote:
' ActiveDocument.PrintOut


Oops - You had better remove the apostrophe from the start of the
line above (used while testing) or it won't print )

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




jaysan3 wrote:
Thanks, Graham. I tried the macro method. However when I print it,
all the serial numbers will appear one after another. Meaning, at
page 2 it will print 0000100002
and page 3 will appear 00001000020003 and so forth.
How do I avoid that?

"Graham Mayor" wrote:

If all the receipts contain exactly the same data apart from the
incrementing number then the Excel method shown on the linked page
http://www.gmayor.com/Numbered_labels.htm will do the job. See
also http://www.gmayor.com/automatic_numbering_documents.htm

If you want to avoid mail merge altogether, then you can do so
with a macro. The following is a minor variation on one I posted
some time ago

The numbers are stored in a text file "Settings.ini" which is
saved for convenience in the Word Startup folder (though you can
use another path if you prefer. The macro reads the next number
from the ini file, types it in the bookmarked cell then prints
the document. The number
is then incremented by one and the process repeated as many times
as you request certificates from the input box. Finally the next
number is written to the ini file for next time.

I have added a macro to reset the number should that be
required.

Sub AddNoFromINIFileToBookmark()
Dim SettingsFile As String
Dim Order As String
Dim iCount As Integer
Dim i As Long
iCount = InputBox("Print how many receipts?", _
"Print Reciepts", 1)
'Save invoice number in the Word startup folder.
SettingsFile = Options.DefaultFilePath(wdStartupPath) &
"\Settings.ini" Order = System.PrivateProfileString(SettingsFile,
_ "ReceiptNumber", "Order")
If Order = "" Then
Order = 1
End If
For i = 1 To iCount
With Selection
.GoTo What:=wdGoToBookmark, _
name:="RecNo"
.TypeText Text:=Format(Order, "00000")
End With
ActiveDocument.PrintOut
Order = Order + 1
Next
System.PrivateProfileString(SettingsFile, "ReceiptNumber", _
"Order") = Order
End Sub


Sub ResetReceiptNo()
Dim SettingsFile As String
Dim Order As String
Dim sQuery As String
SettingsFile = Options.DefaultFilePath(wdStartupPath) &
"\Settings.ini" 'SettingsFile =
Options.DefaultFilePath(wdWorkgroupTemplatesPath) & _
"\Settings.ini" Order = System.PrivateProfileString(SettingsFile,
_ "ReceiptNumber", "Order")
sQuery = InputBox("Reset Receipt Number?", "Reset", Order)
Order = sQuery
System.PrivateProfileString(SettingsFile, "ReceiptNumber", _
"Order") = Order - 1
End Sub

http://www.gmayor.com/installing_macro.htm

Put a bookmark named "RecNo" on the receipt document where you
want the number to appear and run the macro to print as many
incremented receipts as you require.


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



jaysan3 wrote:
Hmm, I am new to merging. But from examples given, it seem to
capture data from outlook contacts.

It doesnt help much as I am printing receipts - no contact
details needed. Just a running number at the top of the receipt.

"Suzanne S. Barnhill" wrote:

I think what Graham was saying was that "labels" are the way to
do it. See http://www.gmayor.com/Numbered_labels.htm.
Understand, they don't have to *be* labels, just set up with a
table like labels. --
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

"jaysan3" wrote in message
...
Something like labels. It is like I want to create a form that
has its own serial number. I dont want to create 100 pages of
that same form.

Easiest example is a cheque book. The number increases but the
cheque is still the same.

"Graham Mayor" wrote:


Labels?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



jaysan3 wrote:
I would like to print 1000 receipts using Word or Excel but
dont want to create that number of pages. Is there any
shorter way to do it?