Link to home
Start Free TrialLog in
Avatar of chucka
chucka

asked on

ActiveX component can't create object

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.
Avatar of anthonyc
anthonyc

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.
Avatar of chucka

ASKER

I'm sorry, I should have mentioned that - Yes, I have set the reference to the Excel Object library.
Avatar of chucka

ASKER

I have already set the freference to the Excel Object Library. I should have mentioned that.
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
Avatar of chucka

ASKER

Nope, err=432, "File name or class name not found during automation operation."
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....
Avatar of chucka

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of danshu
danshu

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chucka

ASKER

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
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
Avatar of chucka

ASKER

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.
Avatar of chucka

ASKER

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.
Avatar of chucka

ASKER

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.
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
Avatar of chucka

ASKER

Yep, it's the same in both reg keys.