Solved

activex can't create object error

Posted on 2000-03-22
8
180 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
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…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

789 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