• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 197
  • Last Modified:

How do I print selected pages in crystal viewer in vb6

I have small application in VB6 with crystal viewer.
It works fine, but when I want to print only selected pages I couldn't. I push Print button but option button "Pages" is dissabled.
What I have to do?
With CRViewer1
   .Top = txtFromdate.Top
   .Width = Me.Width - 5000
   .Height = Me.Height - 800
   .DisplayGroupTree = False
   .EnableRefreshButton = False
   .DisplayToolbar = True
   .EnableToolbar = True
   .EnableDrillDown = True
   .ReportSource = crxRpt
End With

Open in new window

2 Solutions
Have you tried using the PRINT SETUP button?

One way to do this is to add your own button to the viewer and print using it through code.

BAHAppsAuthor Commented:
Finally what I did:

Private Sub CRViewer1_PrintButtonClicked(UseDefault As Boolean)
UseDefault = False
On Error GoTo Cancel:
    CommonDialog1.Max = 1000
    CommonDialog1.CancelError = True
    CommonDialog1.Flags = cdlPDAllPages
    If CommonDialog1.Flags = cdlPDPageNums Then
        crxRpt.PrintOut False, , , CommonDialog1.FromPage, CommonDialog1.ToPage
    ElseIf CommonDialog1.Flags = cdlPDAllPages Then
        crxRpt.PrintOut False
        MsgBox "Please select 'All' or 'Pages'", vbCritical
        Exit Sub
    End If    
Exit Sub

MsgBox "Printing cancelled"
Exit Sub

End Sub
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now