05-14-2012 01:39 PM
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.
05-14-2012 01:41 PM
@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?
05-14-2012 01:42 PM - edited 05-14-2012 01:43 PM
Let me suggest something.
Run the VI in Highlight Execution mode.
05-14-2012 01:45 PM
It works fine on my laptop. Hight or not.
Can you try it on another computer?
Anyone else can try it?
05-14-2012 01:48 PM
05-14-2012 01:49 PM
I'm using XP, LV2009, Excel2007
I'll try on other computer.
05-14-2012 01:51 PM - edited 05-14-2012 01:55 PM
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.
05-14-2012 02:00 PM
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
05-14-2012 02:08 PM
That is code is no longer in his latest VI. You'll need to open his test2.vi which has its problems.
05-14-2012 02:11 PM
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.