Template will not print second page

Template will not print second page

Post by Q2FtZXJvb » Sat, 31 Mar 2007 04:28:05


I have a template file that has a button on the form that prints out attached
files but in some instances will not print out the second page of the primary
document. How do you program the print button to print the first and second
page of the template and then the attachement pages also?
 
 
 

Template will not print second page

Post by Doug Robbi » Sun, 01 Apr 2007 03:52:51

Show us the code that you presently have behind the button.

--
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

 
 
 

Template will not print second page

Post by Q2FtZXJvb » Sun, 01 Apr 2007 05:00:02

Private Sub CommandButton1_Click()
Application.PrintOut FileName:="", _
Range:=wdPrintCurrentPage, _
Item:=wdPrintDocumentContent, _
Copies:=1, _
Pages:="", _
PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, _
Collate:=True, _
Background:=True, _
PrintToFile:=False, _
PrintZoomColumn:=0, _
PrintZoomRow:=0, _
PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0

Application.PrintOut FileName:="", _
Range:=wdPrintRangeOfPages, _
Item:=wdPrintDocumentContent, _
Copies:=1, _
Pages:="2-3", _
PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, _
Collate:=True, _
Background:=True, _
PrintToFile:=False, _
PrintZoomColumn:=0, _
PrintZoomRow:=0, _
PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0

This is what I have, but when the first page prints out it is often more
then 1 page in lenght, is there a way to set the macro up to print out one
page if it has one page and two or more if it has more?

I'm not all that familur with scripting inside word.
 
 
 

Template will not print second page

Post by Doug Robbi » Sun, 01 Apr 2007 14:58:33

I am not sure why you have two

Application.PrintOut

routines, but your problem is almost certainly cause by the following in the
first one

Range:=wdPrintCurrentPage, _

as it will cause only the current page to be printed. That is one page
only.

As you are not setting any of the other parameters of the PrintOut command,
all that you probably should be using is:

ActiveDocument.PrintOut

--
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
 
 
 

Template will not print second page

Post by Q2FtZXJvb » Wed, 25 Apr 2007 06:50:00

ell, what happens with this document is there are a number of paged in it.
The button is placed in the header of each document and if the user wants ot
print out that particular page then certain attached pages also print out
(hense the extra printout statement). But there is one instance in the list
of pages where the context stems over to a second page. For the most part the
current page method works fine but just this one instance. Is there a way to
have the Button click event be able to check to see if there are two or more
pages? Could I out some sort of reference in the document that could trigger
that there where more then two pages and then have to printout method change
to accomidate more then one page? I ask because there is a template file that
could very well have the same problem.

"Doug Robbins - Word MVP" wrote: