Avatar of lindalim
 asked on

Export .rpt reports to pdf, txt, excel etc using vb 6

Hi, i would like to export .rpt files to pdf, txt, excel etc using vb 6. In VB 6 i have use the crystal report viewer 9 to open the crystal report. By rite the viewer should already have the ability to export files to other formats but dun noe y, my viewer in vb 6 dun have the export icon. Can somebody tell mi how can i get the icon or give mi the codes to help export the rpt files to other format. Tks alot... Pls reply ASAP. Tks
Crystal Reports

Avatar of undefined
Last Comment
chris arbon

8/22/2022 - Mon
Mike McCracken

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

ya i am writing the vb program. I hav cr 9 installed on my machine. How do i change the code to EnableExportButton?  And what dlls need to be installed and where can i find he dlls needed? Pls help... tks alot

the EnableExportButton is a property of the crveiwer9.dll

The dll's that need to be installed vary on what you want to be able to support.

crxf_pdf.dll to support pdf
crxf_xls.dll to support excel
crxf_wordw.dll to support msword
crxf_rtf.dll to support rich text format

or is the complete runtime environment dll that you are after ?

sorry but what is runtime environment dll... Can i get all this dll from the cr9 installtion cd?
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes

the runtime environment dll is not just 1 but all the dll's needed to actually deply your application to other computers that do not have cr9.
All dll's are on the installation cd, but i depends on the version of cr9 you have (professional, advance).

Using the package & deployement tool of VB6 will give you most of the required dll in the setup.lst file. But it cannot always find the depency files.
Make sure you create the package on the lowest system you will be using (ie, windows98se). Otherwise you will not get the unicows.dll file.

I you need to get some help on which files should be included, i could give you an example of one of my setup.lst files that runs nicely on w98se, w2k and xp...

*** advertising removed by Netminder, EE Admin ***

Mike McCracken

Glad I could help

Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.

Dear Friends,

Two files CRXF_RTF.DLL is install on my system in 'c:\windows\crystal' directory. When i'm trying to export, i can select the format as "text", but the destination options is giving only in 3 formats ie., a. lotus domino, b. mapi & c. Exchange folder.
Please guide me how to configure my crystal reports to get destination options as "Disk File" and "Application"

With regards and thanks in advance.

Mike McCracken

rajendra_adari - I know the new interface is difficuly but you need to ask your own questions.


How can I export my rpt files into a lst format?
With thanks in advance,
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Mike McCracken

As explained to rajendra_adari - you need to ask your own questions



I am using crystal report v8.5
I click on the export icon & select Acrobat Format (PDF) as Format and Disk File as Destination.

I am not prompted the dialog box "Choose Export File" as to where the file should be saved? Which correct .dll file do I require so that it prompts where to save the file?

Can anyone help me out?

Thanks & Regards,

Mike McCracken

Please ask your own questions.

Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.

I am using vb 6 with the  version of crystal reports that comes with that. I have the export to email button option when i display a report in vb however this button does nothing when clicked. Why is that? the button works in actual crystal reports itself.
Is that a missing dll problem? also if so where can i get the dll files from i have been lookin all over the internet and cant seem to find them.



I would like to export .rpt files to pdf using vb 6. In VB 6 i have use the crystal report 8 to open the crystal report. I want to add 2-3 reports in a single report. is it possible to do like this?  Can somebody give me the codes to help export the rpt files to pdf format. Thanks alot...
Plz. Reply.
Mike McCracken

davidvanrensburg & SahirProjects
Please ask your own questions.

Your help has saved me hundreds of hours of internet surfing.

I am trying to export to PDF a Crystal Reports 8.5 Report using Vb6 Code. I already made to work with the code i have written, but everytime i call the code, and the process of exporting starts i am prompted with the window of the database Logon.

Although i have already edited the report and saved the connection inside the report, i am always prompted with the logon when exorting in VB6.

If i set the logon information, the report in attached on an email in a PDF format.

The problem is i can't put it to release with that bug, because of the end-users. They can't possibly now what the logon information is.

Can anyone help me...


P.S. If asked i will display the code.
Mike McCracken


Please ask your own questions.


i hope this helps
Private Function RptSpooler(reportname As String, p_cod_bank As String, p_cod_branch As String, p_dat_proc As String, p_nam_bank As String, _
p_nam_branch As String, p_user_id As String, p_session_id As String, strDestPath As String) As Boolean
    Dim CrApp As CRAXDRT.Application
    Dim CrRep As CRAXDRT.Report
    Dim myDatabase As CRAXDRT.Database
    Dim myDbTables As CRAXDRT.DatabaseTables
    Dim myDbTable As CRAXDRT.DatabaseTable
    Dim mySections As CRAXDRT.Sections
    Dim mySection As CRAXDRT.Section
    Dim mySubreport As CRAXDRT.Report
    Dim mySubreportObject As CRAXDRT.SubreportObject
    Dim myParameterfields As CRAXDRT.ParameterFieldDefinitions
    Dim myparamfield As CRAXDRT.ParameterFieldDefinition
    Dim crEFTTXT As CRAXDRT.CRExportFormatType
    Dim i As Integer
    Dim j As Integer
    Dim x As Integer
  '''''''''  On Error GoTo cError
    Set CrApp = New CRAXDRT.Application
    Set CrRep = CrApp.OpenReport(reportname)  ' ("C:\flexcube\host\rptdefn\GL008.rpt")
    Set myDatabase = CrRep.Database
    Set myDbTables = myDatabase.Tables
    'Set myDbTable = myDatabase.Table
'                    CrRep.ParameterFields.GetItemByName("p_cod_bank").AddCurrentValue "44"
'                    CrRep.ParameterFields.GetItemByName("p_cod_branch").AddCurrentValue p_cod_branch
'                    CrRep.ParameterFields.GetItemByName("p_dat_proc").AddCurrentValue "01/05/2008"
'                    CrRep.ParameterFields.GetItemByName("p_nam_bank").AddCurrentValue p_nam_bank
'                    CrRep.ParameterFields.GetItemByName("p_nam_branch").AddCurrentValue p_nam_branch
'                    CrRep.ParameterFields.GetItemByName("p_user_id").AddCurrentValue p_user_id
'                    CrRep.ParameterFields.GetItemByName("p_session_id").AddCurrentValue p_session_id
    'CRViewer91.ReportSource =
    i = 1
    For i = 1 To myDbTables.Count
        myDbTables(i).SetLogOnInfo DSN, DSN, uname, pwd
    Next i
    Set mySections = CrRep.Sections
    For Each mySection In mySections
        For x = 1 To mySection.ReportObjects.Count
            If mySection.ReportObjects(x).Kind = crSubreportObject Then
                Set mySubreportObject = mySection.ReportObjects(x)
                Set mySubreport = mySubreportObject.OpenSubreport
                Set myDatabase = mySubreport.Database
                Set myDbTables = myDatabase.Tables
                j = 1
                For j = 1 To myDbTables.Count
                    myDbTables(j).SetLogOnInfo DSN, DSN, uname, pwd
                Next j
            End If
        Next x
    Next mySection
    Set myParameterfields = CrRep.ParameterFields
    For Each myparamfield In myParameterfields
        With myparamfield
            Select Case .ParameterFieldName
                Case "p_cod_bank"
                    .SetCurrentValue p_cod_bank
                Case "p_cod_branch"
                    .SetCurrentValue p_cod_branch
                Case "p_dat_proc"
                    .SetCurrentValue p_dat_proc
                Case "p_nam_bank"
                    .SetCurrentValue p_nam_bank
                Case "p_nam_branch"
                    .SetCurrentValue p_nam_branch
                Case "p_user_id"
                    .SetCurrentValue p_user_id
                Case "p_session_id"
                    .SetCurrentValue p_session_id
            End Select
        End With
    CrRep.EnableParameterPrompting = False
    CrRep.ExportOptions.FormatType = crEFTText  'crEFTPortableDocFormat
    CrRep.ExportOptions.DestinationType = crEDTDiskFile
    CrRep.ExportOptions.DiskFileName = strDestPath
    CrRep.Export (False)
   ' mySection = Nothing
    'mySubreport = Nothing
    'mySubreportObject = Nothing
    Set CrApp = Nothing
    Set CrRep = Nothing
   ' myDbTables = Nothing
    'mySections = Nothing
    'myParameterfields = Nothing
    'myparamfield A = Nothing
    'myDbTable = Nothing
    'myDatabase = Nothing
    RptSpooler = True
'    If Err.Number <> 0 Then
'        MsgBox Err.Description, vbCritical
'        Exit Function
'    Else
'        Me.Caption = Me.Caption + " ..Getting Report data"
'    End If
End Function

Open in new window

Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
chris arbon

The availability of items in the Export Format and Export Destination dropdowns is dependant
 on the dlls present.

u2dmapi.dll gives  Export destination :  MAPI - (Email)
u2ddisk.dll  gives  Export destination : Disk file
Check folder C:\Program Files\Common Files\Crystal Decisions\2.5\bin for CR10
Check folder C:\Program Files\Business Objects\Common\3.5\bin for CR XI

to see if the dll's are present