Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Tue, 6 May 2008 06:23:00 -0700,    group: microsoft.public.word.vba.beginners        back       


User define number of copies printed via macro   
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......
date: Tue, 6 May 2008 06:23:00 -0700   author:   Hellautomobile

Re: User define number of copies printed via macro   
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......
date: Tue, 6 May 2008 16:55:44 +0300   author:   Graham Mayor

Re: User define number of copies printed via macro   
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...... 
> 
> 
>
date: Tue, 6 May 2008 07:44:00 -0700   author:   Hellautomobile

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us