LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Activex Excel Automation: the Missing Handle



You are right if you open a file.  otherwise the activesheet is index 0.

 

Modified your test2.vi to open a file, and close the refnum at the end.  => Excel close when all refnum closed.

 



George,

The code you attached leaves the excel.exe process running, similar to the code I have posted.

0 Kudos
Message 31 of 62
(975 Views)

@nyc_(is_out_of_here) wrote:

I understand what you are having problem with.

 

You didn't simply your large, established working code base correctly, because I don't understand how it even worked in the first place.

 

I will say again, pay attention to what references are being closed and when. The same problem that I saw in the JPG in your first post is still there in the VI you posted last.


This may very well be true.  I have reordered the close references every way I can possibly think of.  Could you please let me know which reference you think is incorrectly closed?

0 Kudos
Message 32 of 62
(974 Views)

Let me suggest something.

 

Run the VI in Highlight Execution mode.

 

0 Kudos
Message 33 of 62
(971 Views)

It works fine on my laptop.  Hight or not.

 

Can you try it on another computer?

 

Anyone else can try it?

 

 

George Zou
0 Kudos
Message 34 of 62
(966 Views)

I tried it and the excel.exe process still run after the vi stopped running. (WinXP, LV2009, excel 2003)

 

Ben64

0 Kudos
Message 35 of 62
(963 Views)

I'm using XP, LV2009, Excel2007

 

I'll try on other computer.

 

George Zou
0 Kudos
Message 36 of 62
(961 Views)

I have Excel 2007 and LV 2010 SP1 and his last test2.vi does not work. Excel remains running, and there is an error during VI execution.

 

 

0 Kudos
Message 37 of 62
(958 Views)

The issue really seems to be the ActiveSheet property. If not use and with the add method with all default parameters the excel.exe process is stopped after the vi run. Just showing the property without converting it to a reference is making the process hang after the vi run. Below an alternate way to use the add method that doesn't need to convert the variant (but the excel.exe process does not stop after the vi run).

 

Ben64

 

 

activeSheet.png

0 Kudos
Message 38 of 62
(948 Views)

That is code is no longer in his latest VI. You'll need to open his test2.vi which has its problems.

 

 

0 Kudos
Message 39 of 62
(941 Views)

Testing on my coworker's computer has revealed on Win7 you don't need to have *any* close references, and the excel.exe process will still stop running after the VI finishes, although you have to wait 10-15 seconds.

 

Here is the latest VI. 

0 Kudos
Message 40 of 62
(939 Views)