J
jaysan3
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?
create that number of pages. Is there any shorter way to do it?
Graham Mayor said: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
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham said:' ActiveDocument.PrintOut
Graham Mayor said: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
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.