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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Specifying Output Tray When Printing Rich Text Box

Status
Not open for further replies.

TripleJHJO

Programmer
Jan 10, 2003
76
US
I have a small program that uses a rich text box that is sized for a label that I wish to print. I can print the rtb to my label printer with no trouble. Now I am trying to print it to another printer, but specify the envelope feeder to allow it to print on an envelope.
Should I be using the selprint method? I am struggling with the syntax.
Can someone provide some insight.

Thanks,
J. Jensen
 
They moved it, but look for this:

Q322710 HOW TO: Raise and Control Print Dialog Boxes from Visual Basic

-David
2006 & 2007 Microsoft Most Valuable Professional (MVP)
2006 Dell Certified System Professional (CSP)
 
I'd suggest that Q322710 is a bit of an overkill for this requirement.

The RTB's .SelPrint method prints to the printer represented by VB's Printer object.

So you just need to set the Printer object's .PaperBin property to vbPRBNEnvelope (or possibly vbPRBNEnvManual) before executing the .SelPrint method of the RTB
 
OK! I am about to beat my head into a wall.
This seems sooooo simple, yet I am missing something here.
When I try to set the .PaperBin property, I am getting an Invalid Property error. This printer (HP4300) has an envelope feeder and should be accepting this command, but it is not. All other lines of code execute, except the PaperBin.
Do I need additional code?
I am including my example code:
Code:
Private Sub Command1_Click()
    On Error GoTo Cancel_It
    
    cmdbPRINT.PrinterDefault = False
   
    cmdbPRINT.Flags = cdlPDReturnDC + cdlPDNoPageNums
    If txtAddress.SelLength = 0 Then
        cmdbPRINT.Flags = cmdbPRINT.Flags + cdlPDAllPages
    Else
        cmdbPRINT.Flags = cmdbPRINT.Flags + cdlPDSelection
    End If
    
    Printer.Orientation = cdlLandscape
    Printer.PaperSize = vbPRPSEnv10
    Printer.PaperBin = vbPRBNEnvelope
    
    cmdbPRINT.ShowPrinter
    
    txtAddress.SelPrint cmdbPRINT.hDC
   
Cancel_It:

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top