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

CR: How to set printer in VB

Status
Not open for further replies.

Sakheb

Programmer
May 22, 2003
11
IN
I have a VB program which generates the Crystal reports and prints them off. The reports are printed to a default printer. I need to know how they can be printed to some other specific printer. Like, what is the code that I should put in my VB program to send some printing jobs to a non-default printer.

Thanks

Sakheb.
 
CR8.5 W/RDC
VB 6.0 SP4

Here's some code that might help. I used "Printout" for my printing. There's more info on Crystal's site.

Example on how to use a printer without using the default.

Dim CrxApp As New CRAXDRT.Application
Dim CrxRpt As CRAXDRT.Report
Option Explicit

Private Sub CRViewer1_PrintButtonClicked(UseDefault As Boolean)

UseDefault = False

On Error GoTo Cancel:
CrxRpt.PrinterSetup Me.hWnd
CrxRpt.PrintOut True

Exit Sub

Cancel:
MsgBox "Printing cancelled"
Exit Sub

End Sub

BradB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top