LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel ActiveX Library with CVI 8.01

I have upgraded to CVI 8.01 from 7.1. I'm using the Microsoft Excel 9.0 Object library to control Excel 2000. With the CVI upgrade I cannot communicate correctly with excel, not even using the Sample programs that come with CVI, (Excel2000demo). When starting a new excel app an error string is recieved from CA_CreateObjectByClassIdEx with "The library is not registered". I can't use any other functions without this going through because it gives the aplication object handle an invalid value of 0. I've tried creating a new ActiveX control from the wizard with no change. Am I missing something simple hear?
0 Kudos
Message 1 of 14
(4,643 Views)
         The ActiveX controls work fine only in certain combinations of software and OS. They work fine with CVI Version 7.1, Excel 2000(9.0.6926SP-3), and Windows XP(SP2). They work fine with CVI version 8.01, Excel 2000(9.0.2720), and Windows 2000(SP4). They just dont work with CVI Version 8.01, Excel 2000(9.0.6926SP-3),  and Windows XP(SP2). As referenced above the error "The library is not registered", (-2147319779) comes from the ActiveX control  from the Microsoft Excel 9.0 Object Library function 'Excel_NewApp'. This function receives the error message from a result of calling the ActiveX control 'CA_CreateObjectByClassIdEx'. Can anyone please explain to me what the conflict is resulting from and how to solve it. I'd appreciate it.
0 Kudos
Message 2 of 14
(4,623 Views)

Nickeli,

When using an activeX control you need to have an active server for the COM interface that CVI autogenerates.  This typically winds up being a VB DLL that is 'registered' on your machine automatically by the ActiveX server you wish to communicate with.  In your case it seems that the DLL providing COM interface to the Excel server has become unregisterd.  To fix this you can use the regsvr32 command with the name of the DLL you wish to register added to it.  For instance, if you wish to register foo.dll you can type regsvr32 foo.dll in your command prompt window.

A good way to check if your target DLL is registered would be to go to your tools->Create ActiveX Controller (on cvi 7.0 or it's equivalent in cvi 8.01) and see if you can find the Microsoft Excel 9.0 object library entry.  If it isn't there, your Excel DLL has become unregistered.

Unfortunately I can't remember the name of the actual DLL that you will need to use with regsvr32, but a search on msdn will probably turn it up.

Good luck!

0 Kudos
Message 3 of 14
(4,613 Views)
The Microsoft Excel 9.0 Object Library is there. I used it to create a new activex control group for Excel to see if that fixed the problem, it didnt.
0 Kudos
Message 4 of 14
(4,600 Views)

Hmm... sounds like something might have been clobbered in your registry. Have you tried repairing the installation of Excel using the original install disk?

If it is really messed up, you may need to re-install it completely.

Martin Fredrickson
Test Engineer

Northrop Grumman
Advanced Systems and Products
San Diego, CA 92128
0 Kudos
Message 5 of 14
(4,587 Views)
        All of the computers in my office are brand new,(2 weeks old). I've tried starting a new project on other computers in the office (all XP, CVI 7.1 or CVI 8.01), with just my source,UIR, .h's, and Excel instruments loaded and no one can use the activex X controls. No one can even use the sample programs that come with CVI, Excel2000dem, or the MS Word samples.
0 Kudos
Message 6 of 14
(4,584 Views)
Then I would suggest rebuilding the ActiveX server for Excel.
 
I had to do this on an XP machine for Word 9.0, it's been a long time since I did it and I don't recall what the snags were (though it did seem to be a bit of a pain at the time).
 
I would recommend building the new ActiveX server in another directory and not overwriting the one that came with CVI.
Martin Fredrickson
Test Engineer

Northrop Grumman
Advanced Systems and Products
San Diego, CA 92128
0 Kudos
Message 7 of 14
(4,583 Views)
There has to be a easier solution than creating an ActiveX Server. I'd try to unregister than register the Excel ActiveX Server but I dont know the name or location of the dll.
0 Kudos
Message 8 of 14
(4,577 Views)
OK, first off, my apologies, I meant recreate the controller, not create a server. Excel is your Server, you need a controller.
 
Creating the controller isn't that difficult, I didn't mean to imply there was an inordinate amount of work involved. Go to the Tools Menu and select Create ActiveX Controller.
 
Follow the prompts in the Wizard, I think you need to leave everything as defaults except for where you want to output the resulting controller.

Message Edited by MJF on 06-30-2006 12:40 PM

Martin Fredrickson
Test Engineer

Northrop Grumman
Advanced Systems and Products
San Diego, CA 92128
0 Kudos
Message 9 of 14
(4,575 Views)
On Reply 4 above what I meant by creating a new activex control group was that I created a new ActiveX controller for Excel from the "Microsoft Excel 9.0 Object Library". This made no difference. Thats why I thought it was something with the server too. The server is registered but not functioning properly to my knowledge with commands coming from CVI 8.01 in WinXP enviornment.
0 Kudos
Message 10 of 14
(4,569 Views)