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

Using RDC in VB 6.0 COM

Status
Not open for further replies.

icallig

Programmer
Jun 20, 2001
3
US
I am trying to use the RDC in a middle-tier VB 6.0 com. The com will eventually be called by an .asp page, but for now I am just doing using a VB 6.0 test interface to try the com.

The problem I am having is that the test program is not recognizing the Sub "FormExportIt" method I used in the com object. It does recognize the ".Name" property. I'm sure the problem is something in the COM, but I don't know what I've done wrong. I'm assuming it's possible to pull the RDC com objects into a new com object; am I wrong?

This is the first COM I've written in VB (or any other language) and I am new to Crystal Reports. Very similar code worked when I used it as an application, but as a com, it's not working, and I have no idea what to try next.


COM code (in the class module):

Public Name As String
Dim Application As CRAXDRT.Application
Dim ExpOpt As CRAXDRT.ExportOptions

Private Sub Class_Initialize()
Set Application = CreateObject("CrystalRuntime.Application")
Set Report = Application.OpenReport(App.Path & "\Report1.rpt")
Debug.Print "Initializing..."
End Sub

Public Sub FormExportIt()
Debug.Print "Sub"
Set ExpOpt = Report.ExportOptions
ExpOpt.DestinationType = crEDTApplication
ExpOpt.ApplicationFileName = "TestRpt.xls"
ExpOpt.FormatType = crEFTExcel80
Report.Export True
End Sub
Private Sub Class_Terminate()
On Error Resume Next
Debug.Print "Terminating..."
End Sub


Test app (in separate project):

Private Declare Sub FormExport Lib "ExpOnlyCR.dll" ()
Private FormThing As ExpOnly

Private Sub Command1_Click()
Set FormThing = New ExpOnly
FormThing.Name = MsgBox("Report1.rpt")
FormThing.FormExportIt
End Sub
 
BTW, I finally realized that I had not dimmed the report object:

Dim report As CRAXDRT.report

Made all the difference! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top