Hi, I am working on a macro which alow user to fill in number of copies to be printed via a formfield. Sub text() X = ActiveDocument.FormFields("Text1") ActiveDocument.PrintOut Copies:=X End Sub Ideally, page 1 will always be printed while the number of copies for page 2 can be defined by user by filling in a formfield. At the moment, when I activate the macro, the printer just keeps printing ...... Please help......
To print out x copies of the document you need Sub test() Dim x As Integer x = ActiveDocument.FormFields("Text1").Result ActiveDocument.PrintOut Copies:=x End Sub To print out page 1 plus x copies of page 2 you need Sub Test() Dim x As Integer With ActiveDocument x = .FormFields("Text1").Result .PrintOut Range:=wdPrintRangeOfPages, Pages:="1", Copies:=1 .PrintOut Range:=wdPrintRangeOfPages, Pages:="2", Copies:=x End With End Sub -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Hellautomobile wrote: > Hi, > > I am working on a macro which alow user to fill in number of copies > to be printed via a formfield. > > Sub text() > X = ActiveDocument.FormFields("Text1") > ActiveDocument.PrintOut Copies:=X > End Sub > > Ideally, page 1 will always be printed while the number of copies for > page 2 can be defined by user by filling in a formfield. > > At the moment, when I activate the macro, the printer just keeps > printing ...... > > Please help......
thanks a bunch Graham !!! "Graham Mayor" wrote: > To print out x copies of the document you need > > Sub test() > Dim x As Integer > x = ActiveDocument.FormFields("Text1").Result > ActiveDocument.PrintOut Copies:=x > End Sub > > To print out page 1 plus x copies of page 2 you need > > Sub Test() > Dim x As Integer > With ActiveDocument > x = .FormFields("Text1").Result > .PrintOut Range:=wdPrintRangeOfPages, Pages:="1", Copies:=1 > .PrintOut Range:=wdPrintRangeOfPages, Pages:="2", Copies:=x > End With > End Sub > > > -- > <>>< ><<> ><<> <>>< ><<> <>>< <>><<> > Graham Mayor - Word MVP > > My web site www.gmayor.com > Word MVP web site http://word.mvps.org > <>>< ><<> ><<> <>>< ><<> <>>< <>><<> > > > Hellautomobile wrote: > > Hi, > > > > I am working on a macro which alow user to fill in number of copies > > to be printed via a formfield. > > > > Sub text() > > X = ActiveDocument.FormFields("Text1") > > ActiveDocument.PrintOut Copies:=X > > End Sub > > > > Ideally, page 1 will always be printed while the number of copies for > > page 2 can be defined by user by filling in a formfield. > > > > At the moment, when I activate the macro, the printer just keeps > > printing ...... > > > > Please help...... > > >