LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel_ActiveApp does not seem to connect to a currently opened spreadsheet

I have a very simple application. A third party program is writing to an opened spreadsheet, via DDE. I want to be able to read certain cells from this spreadsheet in Excel into my program. The demo programs that ship with CVI make it very clear how to do this but what I can't seem to do is to get this to connect to a spreadsheet that is opened.

i.e.
start Excel, type something into A1
start the demo.
click on "Connect to Excel" in the demo and I get a new instance of Excel not the one I opened initially.

Have I misunderstood the functionality of Excel_ActiveApp and if so how do I do what I want, thanks.
0 Kudos
Message 1 of 4
(3,466 Views)
Hello Kevin,

Which version of Excel are you using, because when I use Excel 2002 SP3 with CVI 7.1.1 I am able to successfully use the Excel_ActievApp function, as mentioned in the following KnowledgeBase, and connect to a previously opened worksheet.

You might try recreating the ActiveX controller for the Microsoft Excel Object Library by going to Tools >> Create ActiveX Controller to see if that correct the issue.

Thanks.
Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 2 of 4
(3,462 Views)
Wendy,

I was using Excel 2000 and CVI 6.0. I also tried it on Excel 2003 and CVI 7.1 and it had the same problem. Recreating the controller as you suggested does seem to solve the problem though, thanks. What implication does this have for my target machine I wonder?

Kevin
0 Kudos
Message 3 of 4
(3,447 Views)
Hello Kevin S,

Since the Excel object model changes from version to version, a ActiveX controller created for one version is not gauranteed to work with a different version. Therefore, when distributing your application, you should make sure that you distribute the newly created ActiveX controller with your application and that your test machine has the same version of Excel on it.

Thanks.
Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 4 of 4
(3,440 Views)