LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

excel report generation does not exit excel

Solved!
Go to solution

Report Example.pngI 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?

0 Kudos
Message 1 of 33
(4,397 Views)

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.

Message 2 of 33
(4,385 Views)

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

0 Kudos
Message 3 of 33
(4,380 Views)

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.

0 Kudos
Message 4 of 33
(4,376 Views)
Solution
Accepted by _Bryan

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.

Message 5 of 33
(4,363 Views)

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.

0 Kudos
Message 6 of 33
(4,359 Views)

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.

0 Kudos
Message 7 of 33
(4,351 Views)

@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.

0 Kudos
Message 8 of 33
(4,344 Views)

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.

0 Kudos
Message 9 of 33
(4,336 Views)

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...

0 Kudos
Message 10 of 33
(4,328 Views)