Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Sequential number generator for raffle tickets
Can I make a sequential number generator from word that will print numbers
starting at any number I choose (ex: 100500) that will print each number on a seperate ticket? Thanks |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Sequential number generator for raffle tickets
The following is a modification of the code in the article "Sequentially
numbering multiple copies of single document using a macro" at: http://www.word.mvps.org/FAQs/Macros...piesOf1Doc.htm that will let you specify the starting number: Dim Message As String, Title As String, Default As String, NumCopies As Long Dim Rng1 As Range ' Set prompt. Message = "Enter the number of copies that you want to print" ' Set title. Title = "Print" ' Set default. Default = "1" ' Display message, title, and default value. NumCopies = Val(InputBox(Message, Title, Default)) SerialNumber = System.PrivateProfileString("C:\Settings.Txt", _ "MacroSettings", "SerialNumber") If SerialNumber = "" Then SerialNumber = InputBox("Enter the starting number", "Set Starting Number", "1") End If Set Rng1 = ActiveDocument.Bookmarks("SerialNumber").Range Counter = 0 While Counter NumCopies Rng1.Delete Rng1.Text = SerialNumber ActiveDocument.PrintOut SerialNumber = SerialNumber + 1 Counter = Counter + 1 Wend 'Save the next number back to the Settings.txt file ready for the next use. System.PrivateProfileString("C:\Settings.txt", "MacroSettings", _ "SerialNumber") = SerialNumber 'Recreate the bookmark ready for the next use. With ActiveDocument.Bookmarks .Add Name:="SerialNumber", Range:=Rng1 End With ActiveDocument.Save You may however want to consider whether it might not be better to be using mailmerge for this where you use a column of numbers in an Excel spreadsheet as the datasource. -- 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 "Diggar" wrote in message ... Can I make a sequential number generator from word that will print numbers starting at any number I choose (ex: 100500) that will print each number on a seperate ticket? Thanks |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Sequential number generator for raffle tickets
See also http://www.gmayor.com/Numbered_labels.htm
-- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Diggar wrote: Can I make a sequential number generator from word that will print numbers starting at any number I choose (ex: 100500) that will print each number on a seperate ticket? Thanks |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Sequential number generator for raffle tickets
|
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
sequential number compile error | Microsoft Word Help | |||
Raffle Ticket Template uses same number on all tickets | Microsoft Word Help | |||
How do I insert chapter number with page number in footer? | Microsoft Word Help | |||
Maximum number of pages in a word document | Formatting Long Documents | |||
Sequential numbering for tickets? | Microsoft Word Help |