twopagesonone

A

Addy

I have tried using this in a macro to print to a canon photocopier but it
isn't working correctly. It is splitting my first page and putting half on
the top, a gap and the other half of the page on the bottom. My code looks
like this. Can anyone help

Cheers

Addy

Private Sub CBO2PS_Click()

If CBO2PS.Value = True Then

ActivePrinter = "\\rother\CanonMF13"

With ActiveDocument.PageSetup
.PaperSize = wdPaperA4
.Orientation = wdOrientLandscape
.TwoPagesOnOne = True
End With

ActiveDocument.PrintOut Copies:=CBO2PS.Value

With ActiveDocument.PageSetup
.PaperSize = wdPaperA4
.Orientation = wdOrientPortrait
.TwoPagesOnOne = False
End With

ActivePrinter = "\\rother\lex1340"
Else
ActivePrinter = "\\rother\lex1435"

End If
End Sub
 
D

Doug Robbins - Word MVP

Instead of messing with the page setup, use the PrintZoomColumn and
PrintZoomRow attributes of the PrintOut method.

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

Addy

That's fab thanks it worked. I didn't know that code existed but I am a
novice. I have tried putting a border around each page but it doesn't work.
I've tried all sorted. I managed to put a border around the first paragraph
but can't get it around each column. This is my code so far. Can you help
please?

cheers

Private Sub CBO2PS_Click()

If CBO2PS.Value = True Then

ActivePrinter = "\\rother\CanonMF13"

ActiveDocument.PrintOut printzoomColumn:=2, PrintZoomRow:=1
With Selection.Columns(2)
.Borders.Enable = True
End With


Copies = CBO2PS.Value

With Selection.Columns(2)
.Borders.Enable = False
End With




ActivePrinter = "\\rother\lex1340"
Else
ActivePrinter = "\\rother\lex1435"

End If


End Sub
 
D

Doug Robbins - Word MVP

Try

If CBO2PS.Value = True Then
ActivePrinter = "\\rother\CanonMF13"
ActiveDocument.UndoClear
With Options
.DefaultBorderLineStyle = wdLineStyleSingle
.DefaultBorderLineWidth = wdLineWidth050pt
.DefaultBorderColor = wdColorAutomatic
End With
With ActiveDocument.Sections(1)
With .Borders(wdBorderLeft)
.LineStyle = wdLineStyleSingle
End With
With .Borders(wdBorderRight)
.LineStyle = wdLineStyleSingle
End With
With .Borders(wdBorderTop)
.LineStyle = wdLineStyleSingle
End With
With .Borders(wdBorderBottom)
.LineStyle = wdLineStyleSingle
End With
With .Borders
.DistanceFrom = wdBorderDistanceFromPageEdge
.AlwaysInFront = True
.SurroundHeader = True
.SurroundFooter = True
.JoinBorders = False
.DistanceFromTop = 24
.DistanceFromLeft = 24
.DistanceFromBottom = 24
.DistanceFromRight = 24
.Shadow = False
.EnableFirstPageInSection = True
.EnableOtherPagesInSection = True
.ApplyPageBordersToAllSections
End With
End With
With ActiveDocument
.PrintOut printzoomColumn:=2, PrintZoomRow:=1 ',
Copies:=CBO2PS.Value
.Undo 18
End With
Selection.Collapse wdCollapseStart
ActivePrinter = "\\rother\lex1340"
Else
ActivePrinter = "\\rother\lex1435"
End If


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

Addy

That's fab. Didn't think it would be that complicated. Understand what most
of it does although I know I wouldn't be able to reproduce it myself but what
do the following codes do please?

..Undo 18
Selection.Collapse wdCollapseStart

I've also been trying to get my duplex to work on both a Lexmark printer and
Canon photocopier but neither will work. People on this site have said that
I will have to set up separate printer drivers but I have seen duplex within
VBA but it doesn't seem to work. I've tried various combinations including
both these:-

manualduplexprint:=true

and

ActiveDocument.PageSetup.finishingmode = duplex

Any ideas please. Also I would like to set staple and hole punch options
but I've a feeling that will have to be separate printer drivers but how
would I go about if someone wanted staple and hole punch would I have to have
3 separate drivers, 1 for staple, 1 for hole punch and 1 for both?

Many thanks for all your help

Addy
 
D

Doug Robbins - Word MVP

It puts your document back the way that it was, that is without the borders.
To see the effect of omitting it, just preface it with an apostrophe.

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

Doug Robbins - Word MVP

The normal way is to install multiple copies of the printers, renaming each
one and setting the properties of each to invoke the desired functions and
then use code to select the appropriate printer depending upon the output
required.

See http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=101

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

printing defaults 2
macro problems 0
Printing Current Page problem 5
Help with my printer macro 1
Writing VBA code for changing page setup 1
Page setup 14
Word macro help- formatting and printing 2
Letterhead Macro 1

Top