Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Duplex

Status
Not open for further replies.

sflau

Programmer
Oct 18, 2001
87
0
0
HK
I am using VB 6.0 to control MS Word 2000 for print out. But I can't control to print the document in duplex.

I am trying to use:

wordDoc.PrintOut Background:=False, manualduplexprint:=True

or

wordApp.ActiveDocument.PrintOut
Range:=wdPrintAllDocument, Item:=wdPrintDocumentContent,
Copies:=1, Pages:="", PageType:=wdPrintAllPages,
ManualDuplexPrint:=True, Collate:=True, Background:=False,
PrintToFile:=False, PrintZoomColumn:=0, PrintZoomRow:=0,
PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0

or

run "printer.duplex = 2" before printing.

But, they doesn't work.

Can anyone help me, please? Thank you so much.
 
we had problems and came up with this

It aint elegant, but ...


'procedure to set the duplex option on the printer
'Bloody nuisance that word VBA does not supply appropriate commands
'therefore have to use poxy sendkeys to manipulate print setup box
'
'intDuplexMode argument
' 1 = No Duplex
' 2 = Long Side
' 3 = Short Side
'
'NB The bit after the SendKeys statement (i.e. the %FP%T... etc) may be rather
'more than needed. But as it works, we've left it alone...

Public Sub SetDuplex(ByVal intDuplexMode As Integer)

Select Case intDuplexMode
Case 1 'none
frmControl.txtLog.Text = vbCrLf & "Setting Duplex OFF" & " " & Now & vbCrLf & frmControl.txtLog.Text
WordBasic.SendKeys "%FP%T%O%N{Enter}"
WordBasic.FilePrintSetup Options:=1
Case 2 'Long
frmControl.txtLog.Text = vbCrLf & "Setting to Duplex LONG SIDE" & " " & Now & vbCrLf & frmControl.txtLog.Text
WordBasic.SendKeys "%FP%T%O%D{Enter}"
WordBasic.FilePrintSetup Options:=1
Case 3 'short
frmControl.txtLog.Text = vbCrLf & "Setting to Duplex SHORT SIDE" & " " & Now & vbCrLf & frmControl.txtLog.Text
WordBasic.SendKeys "%FP%T%O%H{Enter}"
WordBasic.FilePrintSetup Options:=1
Case Else
frmControl.txtLog.Text = vbCrLf & "Setting Duplex OFF" & " " & Now & vbCrLf & frmControl.txtLog.Text
WordBasic.SendKeys "%FP%T%O%N{Enter}"
WordBasic.FilePrintSetup Options:=1
End Select
DoEvents


End Sub

 
sflau,

AFAIK it works fine. I've used similar code in my printer management library, PDXPro (ActiveX DLL). You could download a copy from my web site and use the Test Bench application that comes with it to try against your printer. I'd be interested to know the results.

Paul Bent
Northwind IT Systems
 
Finally, I havn't tried the code sorry.

I install two printers (drivers) for actual the same printer. One is for Single, another is for Duplex.
 
I am running into the same problem as sflau. Is there anyone who could walk me through how to create to create two printers (drivers) for the same printer?

Swi
 
Start -> Settings -> Control Panel -> Printers -> "Add New Printer" will bring up the "Add Printer Wizard." I am convinced all of the duplex problems are caused by the printer drivers since none of the proven "fixes" seem to work.

I hope this helps!
Brett (smsforce)

--------------------------
Please visit my website!
 
I have resolved this issue. Thanks anyway.

Swi
 
I used paulbent's (or should I say Microsoft's) solution. The one thing they neglect to say is if it is a network printer you need to make sure you have rights to the printer. As soon as our network administrator gave me permissions I was able to use the code from Microsoft.

Swi
 
I am having trouble finding code that will allow automatic duplex printing for Excel spreadsheets. Can anyone tell me if the code suggested above for Word could be applied to Excel also?(Sorry, I've just started using VB) If not, has anyone had success with this?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top