2015-10-14 87 views
1

我正在使用VB6和水晶報告8.5,我想用默認打印機直接打印我的報告,無需預覽,然後單擊打印按鈕。我有這樣的代碼和,但是當過我嘗試打印它讓我看到預覽和我必須點擊打印按鈕打印過程 這裏是我的代碼vb6打印水晶報告沒有預覽和點擊打印按鈕

With MAIN.CR 
    .Reset: MAIN.InitCrys 
    .ReportFileName = App.Path & "\Reports\rptCashInvoice.rpt" 
    .Connect = "POS" 

    strTitle = "Cash Invoice" 

    strSelFormula = "{Cash_Sales.InvoiceNo} ='" & InvoiceNo & "'" 

    .SelectionFormula = strSelFormula 

      .WindowTitle = strTitle 

      .ParameterFields(0) = "prmCompany;" & CurrBiz.BUSINESS_NAME & ";True" 
      .ParameterFields(1) = "prmAddress;" & CurrBiz.BUSINESS_ADDRESS & ";True" 
      .ParameterFields(2) = "prmContactInfo;" & CurrBiz.BUSINESS_CONTACT_INFO & ";True" 

      .PrintReport 
      .DiscardSavedData = True 
End With 

回答

1

試着這麼做:

Dim crxApp As CRAXDRT.Application 
Dim crxRpt As CRAXDRT.Report 

Set crxApp = New CRAXDRT.Application 
Set crxRpt = crxApp.OpenReport("C:\MyReport.rpt") 

crxRpt.PrintOut False, NoCopies 

如果您需要在其他打印機上打印默認報告,請嘗試使用SelectPrinter。

Look at this page

相關問題