Solved

activex can't create object error

Posted on 2000-03-22
8
177 Views
Last Modified: 2013-11-26
hello everyone.

I have this problem with my activex component. When i create an instance of
it,  it generates an error - activex component can't create object. What
does this mean? it's  weird since my older version of this component works
perfectly. Additional info. I used VB 6.0 sp3 to create this component. It
uses excel 97 component to manipulate excel files. Now my system has two
versions of excel 97 and 2000. My system is windows nt sp5.

0
Comment
Question by:HokSun
8 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 2645087
Maybe post some of the code (Lines with the DIMs and the Lines with CREATEOBJECT or NEW)
This will help to answer precisely
0
 

Accepted Solution

by:
ivysoft earned 50 total points
ID: 2645165
U are getting the error while creating the instance of ur component
Two options
1) Either Ur component is failing.
2) The Excel is failing.
Since u havent mentioned i assume, u are getting this error while doing
createobject("MyComponent") or
Dim oMC as new MyComponent

Again there are two possiblities
a) If u are instantiating Excel in the Class_Intialize event of Ur component and if there isnt any error handling and if Excel fails to instantiate, u can get this error.
b) Ur component itself fails to instantiate.

If a) doesnt apply ur component is failing.

So what u need to do is check the compatibility of the new component to the previous working version by setting binary compatibility. Recompile and make the new component again. if it breaks the compatibilty, then u will need to reference this new component again in the application U R using and it will work fine.

Or

if a) applies then u need to catch the error in the class_intialize and check if excel is failing. U need to check the excel references if they are available or not.


Hope this helps.

Brij

N.B : - Run regclean on ur machine so that corrupt class ids are removed.
0
 
LVL 1

Author Comment

by:HokSun
ID: 2648002
Hi, thanks for your comment. to answer your question  ivysoft:

the error occurs on NEW command.

I did not instantiate the excel object in the class_initialize event

I've already recompiled the project but the component created has this bug or error. This is same project i created before without error, so i suppose the error has nothing to do with my codes.

But i've debugged the project in  another machine which has only excel 2000 in it, during the debugging mode where i Run the main project and component project, there was no error . This time the main project references the component project not the dll i created earlier.
0
 
LVL 1

Author Comment

by:HokSun
ID: 2648016
In addtion to my previous comment,

but when i make a dll in this another machine and register it so that my exe program will use it, when the exe program runs and use the component an error happens (activex component can't create object). In short, during the debugging mode where i use the exe project and component project in vb, i can run exe project without error. but when i compile the component to dll, the exe program could not use it correctly.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Expert Comment

by:Ardman
ID: 2648481
Hi,
I've been working a lot with ActiveX over the past couple of months. I have had the same error as you have. Maybe you could post some code examples or email direct.

Neil
0
 

Expert Comment

by:ivysoft
ID: 2649581
Compile the component and add to the references and try iton the machine on which U dont get the errors and test it at run time.

Brij
0
 
LVL 1

Author Comment

by:HokSun
ID: 2652961
ivysoft,

i've also tested it at run-time on the machine where the error does not happen at design time.  But the error is still there at run-time.
0
 

Expert Comment

by:ivysoft
ID: 2653558
So this is definitely compatibilty problem. I suggest remove all component references from Ur project. Unregister all versions. Run RegClean. reregister previous component. Then recompile with binary compatibility set. And try it at run time.

Brij
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB6 code to programmatically convert pdf to excel 21 65
Spell Check in VB6 13 95
Can we place a tooltip on the actual vb6 form 5 35
Passing a Text Box name to a Sub 6 69
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

937 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now