03-20-2014 12:36 PM - edited 03-20-2014 12:37 PM
I am using the excel report generator to save test reports. I can create the report using a template and write to it when needed with no problems. After every test step I add data and save the report. I keep excel closed by using the no change setting for the window state. I do not want the user to see excel or even know it is there.
The issue is when I am done testing and use the dispose report vi, it leaves an instance of excel open that you can see in the task manager. And the only way to close that instance is to open one of the files that was created and close it and then exit excel. The memory used by that instance grows a little each time a new file is created.
Labview 2011 SP1 (11.0.1.F2 32bit)
Excel 2007
How can I close excel completely after each test?
Solved! Go to Solution.
03-20-2014 12:55 PM
I find it very hard to believe that this function isn't somewhere in the report generation toolkit. But my 30 second look for it came up with nothing. So instead I wrote a function that does a task kill for you. Keep in mind this only works in Windows, and this will do the same thing as a end task in Taskmanager so only use it when you are sure your are done saving all reporting. Saved in 2011.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
03-20-2014 01:12 PM
Inside the dispose report.vi there is an Excel_Quit.vi that has an invoke node that calls application quit. But it does not kill the task.
I agree that the toolkit should have a way to kill the task it created. But I will try your VI and see what happens.
Thanks
03-20-2014 01:23 PM - edited 03-20-2014 01:25 PM
No joy with your VI. I get a process 8636 not found error.
I put your VI between the save and dispose vi's in the example.
03-20-2014 01:59 PM
You are so right sorry. Attached is a improved version that does work but again not sure if there is a better way.
This will get the HWND before disposing, the dispose like normal, then given the HWND get PID (this was the wrong terminal last time) and then kill based on that. This appears to work and I tested it this time.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
03-20-2014 02:05 PM
I'm using LabVIEW 2011 with Excel 2013 on a windows 8 computer and I'm getting the expected result. Excel does not open and therefore no need to kill it.. Is it possibly to upgrade to Excel 2010 or newer to see if that eliminates the issue?
Make sure you have no errors on the error line that would keep the report from being disposed.
03-20-2014 02:11 PM
I was lucky to get Office 2007 installed and I am using win 7. I will have to check around to see if my IT department has a newer version. But since they installed this version (2007) a few days ago I doubt it.
I do not get any errors generated when running the example. Do you get an excel task in the task manager when the program runs and then goes away after the dispose report vi? Just wondering, but I imagine you should.
03-20-2014 02:25 PM - edited 03-20-2014 02:26 PM
@tmf171 wrote:
I'm using LabVIEW 2011 with Excel 2013 on a windows 8 computer and I'm getting the expected result. Excel does not open and therefore no need to kill it.. Is it possibly to upgrade to Excel 2010 or newer to see if that eliminates the issue?
Make sure you have no errors on the error line that would keep the report from being disposed.
You are incorrect in saying Excel does not open. Of course it does how else does the report get saved? You aren't seeing it but the application starts and is listed in the task manager.
I'm on LabVIEW 2011 SP1, Excel 2010, and Widnows 7 SP1. If I run the VI posted, but disable all code after the dispose (so no task kill) after running Excel.EXE remains in the task manager. There is no window for it but the application is still running.
EDIT: Oh and there are no errors on the output of the dispose.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
03-20-2014 02:33 PM
Hooovahh
You are right, Excel does open in the background. It will close for me though and disappears from task manager even with an error on the error line.
I know that I have had problems with version of report generator and versions of labview disagreeing with versions of microsoft office. Again, those were fairly isolated and we were able to work around them fairly easily.
I am going to find another computer to try on.
03-20-2014 02:49 PM
On windows 7 computer my Excel 2010 stays open. I have no way of knowing if it is office version(2010 vs 2013) or windows 7 vs windows 8. Trying to figure out if i can use system exec commands to fix...