Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
I found the macro below on a web site to print out multiple copies that are
numbered. This works great, but I need to know how to add another variable Inputbox. I would like the user to be able to enter in a Job Number that is placed in a specific place in the document. Sub COPIES() ' ' COPIES Macro ' Dim varItem As Variable Dim bExists As Boolean Dim lCopiesToPrint As Long Dim lCounter As Long Dim lCopyNumFrom As Long ' ensure our doc variable exists bExists = False For Each varItem In ActiveDocument.Variables If varItem.Name = "CopyNum" Then bExists = True Exit For End If Next varItem ' initialize document variable if doesn't exist If Not bExists Then ActiveDocument.Variables.Add _ Name:="CopyNum", Value:=0 End If ' ask how many to print lCopiesToPrint = InputBox( _ Prompt:="How many copies?", _ Title:="Print And Number Copies", _ Default:="1") ' ask where to start numbering lCopyNumFrom = CLng(InputBox( _ Prompt:="Number at which to start numbering copies?", _ Title:="Print And Number Copies", _ Default:=CStr(ActiveDocument.Variables("CopyNum") + 1))) ' loop through the print-write-print cycle For lCounter = 0 To lCopiesToPrint - 1 ' update the document variable ActiveDocument.Variables("CopyNum") = _ lCopyNumFrom + lCounter ' print this numbered copy ActiveDocument.PrintOut COPIES:=1 Next lCounter End Sub Thank You, Mark |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Word 2003 | Microsoft Word Help | |||
SQL Prompt When opening merged documents | Mailmerge | |||
create a macro to update (save) document | Microsoft Word Help | |||
Can you save individual document pages as seperate word files? | Mailmerge | |||
Turning off Line Numbering Macro unformats my document! | Page Layout |