Solved

activex can't create object error

Posted on 2000-03-22
8
181 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 143

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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

685 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