cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX can't create object

Former Member
0 Kudos

Deal All,

I have some problem to run my program which containing Crystal Report viewer in client's computer (which do not installed Crystal report)

here are the errorr message that appear from the Add On program

"ActiveX component can not create Object"

this message will appear when user connecting my Add On trough Add On Manager

Is there any problem with the Code?

or should I install Crystal Report on client's computer ?

Thank a lot before

Arie

SDK Beginner

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi 4rie,

You need to install the Crystal Reports Runtime files.

Regards,

Vítor Vieira

Former Member
0 Kudos

Mr Vieira,

I already install Crystal Report Runtime files, and the message dissapear..

but another problem comes.. there ar eanother errorr message appear :

"Class doesn't not support automation or doesn't support expected interface "

Is it because using activex class id from VB 6 ?

But it works on my laptop ...

Here are code that I use to view Crystal Report from UI

Public Sub GenerateReport(ReportFile as String)

Dim CP As SAPbouiCOM.FormCreationParams

Dim fTree As SAPbouiCOM.Form

Dim AcXTree As SAPbouiCOM.ActiveX

Dim oItem As SAPbouiCOM.Item

Dim i As Integer

Set CP = oApplication.CreateObject(cot_FormCreationParams)

CP.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Sizable

CP.FormType = "ACXTree"

CP.UniqueID = "ACTree1"

Set fTree = oApplication.Forms.AddEx(CP)

fTree.Left = 10

fTree.Top = 10

fTree.Width = 1150

fTree.Height = 660

fTree.Title = "Crystal Report Form"

fTree.AutoManaged = True

' Add the TreeView Control to the form

Set oItem = fTree.Items.Add("Tree", SAPbouiCOM.BoFormItemTypes.it_ACTIVE_X)

oItem.Left = 1

oItem.Top = 1

oItem.Width = 1142

oItem.Height = 630

' Create the new activeX control

Set AcXTree = oItem.Specific

Dim CRApp As New CRAXDDRT.Application

Dim CRRep As CRAXDDRT.Report

'CreateObject("CrystalRuntime.Application")

Set CRRep = CRApp.OpenReport(ReportFile)

AcXTree.ClassID = "CrystalReports12.ActiveXReportViewer.1"

Dim oTreeView As CrystalActiveXReportViewerLib12Ctl.ICrystalReportViewer11

Set oTreeView = AcXTree.Object

oTreeView.EnableToolbar = True

oTreeView.EnableStopButton = True

oTreeView.EnableSelectExpertButton = True

oTreeView.EnableSearchControl = True

oTreeView.EnableRefreshButton = True

oTreeView.EnableProgressControl = True

oTreeView.EnablePrintButton = True

oTreeView.EnablePopupMenu = True

oTreeView.EnableGroupTree = True

oTreeView.DisplayGroupTree = True

oTreeView.ReportSource = CRRep

oTreeView.ViewReport

' Make the form visible

fTree.Visible = True

What makes it stilll errorr on client computer like that ?

Former Member
0 Kudos

4rie,

I code very little ActiveX controls into my B1 add-on, but I'm almost certain that you need to set the ActiveX ClassID when you create it, which you are not doing.


        AcXTree = oItem.Specific
        AcXTree.ClassID = "MSComctlLib.TreeCtrl.2"
        oTreeView = AcXTree.Object

Please take a look at the ActiveX SDK Sample and see what you're doing wrong.

Also, I open my Crystal Reports in a .NET form, not a B1 form...

Regrads,

Vìtor Vieira

Former Member
0 Kudos

Mr Vieira,

I have already try your Code replacing mine...

... but when it steps to code " oTreeView = AcXTree.Object" system raised error message "Type Mismatch "

Can I know how you declare oTreeView ?

I declare oTreeView as "Dim oTreeView As CrystalActiveXReportViewerLib12Ctl.ICrystalReportViewer11"

Is it already correct ?

And is that problems when I use VB6 instead of VB .Net ?

Many Thanks Before

Arie

Former Member
0 Kudos

Hi 4rie,

The code I provided is just a sample taken from the SDK code samples.


AcXTree.ClassID = "MSComctlLib.TreeCtrl.2"

The above ClassID is for a TreeControl. You need to search you registry for the correct ClassID for the control you're trying to instantiate (CrystalActiveXReportViewerLib12Ctl.ICrystalReportViewer11).

If other words, different controls have different ClassID's. You can see the ClassID as you're controls digital signature. With out it, the application won't recognize the control neither it's objects/methods...

Regards,

Vítor Vieira

Former Member
0 Kudos

Mr. Vieira,

I just realize that activex couldn't run well under VB 6 code, as stated on SDK Help which said :

Remarks

The UI API does not support ActiveX objects written in Visual Basic 6.0.

So I finally use simple VB Form and bind Crystal Report Viewer into my Add On

Thanks a lot Sir...

Former Member
0 Kudos

Hello,

We are trying to do the exact same thing you did i.e. open a crystal report using the SDK. After trying the code from the forum, we are still facing some issues running the code succesfully.

Would really appreciate it if you could share with us how you have managed to open a vb form with crystal reports?

Thanks.

Answers (1)

Answers (1)

0 Kudos

Hi ,

Go to this Link http://www.macropool.com/en/download/scripting.html

and flow the instraction over there .

i hope it will solve your prob

Thanks

Sam