Solved

activex can't create object error

Posted on 2000-03-22
8
176 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…

746 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

11 Experts available now in Live!

Get 1:1 Help Now