Solved

ActiveX component can't create object

Posted on 1998-08-21
15
235 Views
Last Modified: 2010-04-30
I have a Standard Exe VB program and am trying to activate Excel. I have defined appexcel as object. When I do "Set AppExcel = New Excel.Application", I get err-code 429 and the message "ActiveX component can't create object". The program is a standard EXE, not an ActiveX component. I re-installed XL, but no luck. I AM able to activate Word, but not Excel. I've done this before in other programs and have no idea why I can't do it in this program. Naturally, I have a deadline for this of Monday so any help is greatly appreciated.
0
Comment
Question by:chucka
  • 9
  • 5
15 Comments
 
LVL 6

Expert Comment

by:anthonyc
ID: 1430275
Do you have the Excel object library referenced in your project?

dim xlCur as excel.application
set xlCur = new excel.application  

This should work if you have the object library marked as a reference in your project.
0
 

Author Comment

by:chucka
ID: 1430276
I'm sorry, I should have mentioned that - Yes, I have set the reference to the Excel Object library.
0
 

Author Comment

by:chucka
ID: 1430277
I have already set the freference to the Excel Object Library. I should have mentioned that.
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 6

Expert Comment

by:anthonyc
ID: 1430278
Can you build an existing XL file, and use getobject to open it?  This doesn't fix your problem, but I am curious if you could do this

dim xlCur as excel.application
set xlCur = getobject("c:\path\to\xl.xls")

and make it work
0
 

Author Comment

by:chucka
ID: 1430279
Nope, err=432, "File name or class name not found during automation operation."
0
 
LVL 6

Expert Comment

by:anthonyc
ID: 1430280
well assuming you placed an excel file where you said it was and it did not open..... then I don't know what to say.. sounds ike the excel library needs to be registered....
0
 

Author Comment

by:chucka
ID: 1430281
Agreed. That's why I reinstalled XL. Am I missing something here? ie. Is there a way to register it other than a reinstall? I am goint to try it on my machine at home tonight. Just FYI, I'll let you know what happens there.
Thanks for the help.
0
 

Accepted Solution

by:
danshu earned 50 total points
ID: 1430282
I have met the same prolem. I can not create any object of Excel unless Excel is already running. So, try to run Excel first, then run your program.

That is not a good solution. Anyway wish it will do a little help for you. Good luck.  
0
 

Author Comment

by:chucka
ID: 1430283
OK, but I'll have to try it on Monday. It works fine on my machine at the house. However, your answer brings up an interesting observation. I also CANNOT activate Access by trying to activate a database. I have to first start Access and then open the database. I'll bet there's a relationship to these 2 problems. On Monday I'll try starting XL first. If that works, I can at least test at the office. I'll let you know.

Thanks
0
 
LVL 6

Expert Comment

by:anthonyc
ID: 1430284
Something is wrong.  I can use CreateObject and start up excel without ANY problems.

if I do this (with excel NOT running, and a reference to Excel 8.0 in my object refs)

dim x as new excel.application


Excel opens... invisible, until I set the visible prop = true
0
 

Author Comment

by:chucka
ID: 1430285
I've tried to do it with XL running (err.number is 429). I also tried defining it as new Excel.application and I get the same thing. I have no problems running this at home. Both machines are configured nearly the same.
0
 

Author Comment

by:chucka
ID: 1430286
This is getting even more annoying. When I build a setup file for it, all goes well, except that when I do an install and then run the app (on a different machine), there is NOTHING on the form. No labels, no controls, etc.....

I've done this several times before with other apps with no problem.
0
 

Author Comment

by:chucka
ID: 1430287
Scratch my last comment. This XL thing has got me so flustered, I forgot to recompile the app before I built setup. At least that part works and as long as I install on a machine othert than my own, the XL stuff works too. The big problem is that I develop on THIS machine.
0
 
LVL 6

Expert Comment

by:anthonyc
ID: 1430288
Look in your registry under

\\hkey_classes_root\excel.application\

and make sure the class ID is:
{00024500-0000-0000-C000-000000000046}


Check the same in

\\hkey_local_machine\software\classes\excel.application
0
 

Author Comment

by:chucka
ID: 1430289
Yep, it's the same in both reg keys.

0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Validating VB6 Function 19 59
Run code from text file in vb 1 64
MS Date Picker 64 bit 32 bit issue 12 53
How to read File Date Created using VB6 8 39
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…
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…
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…

776 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