LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Closing Excel with Excel Report

I have an application that saves data into a spreadsheet.  Once labwindows is done doing its thing the user modifies the spread sheet and closes it. 

 

Whenever excel is started by labwindows it creates an image name in the processes window in Windows Task Manager.   When the user closes excel this process remains active and at the end of the day I have 30 or so active images in the process window.

 

My question is…..is there a way to have labwindows release control of excel to the user so that I do not get multiple images without closing excel?
0 Kudos
Message 1 of 4
(3,949 Views)
With the ExcelRpt_ApplicationQuit function, you can close the excel-instance. In your case, when you don´t want to close excel, because the user should use it afterwards, you have to release the handle to the activeX Server with the function CA_DiscardObjHandle.

Hope this helps!
0 Kudos
Message 2 of 4
(3,943 Views)

Thanks but I still am having some issues.

1)  Using the close amplication in excel report does not release the handle and using CA_DiscardObjHandle will not work once you have closed excel.

2)  If the user closes excel before releasing the application you can no longer release it.  How can I address this?

 

0 Kudos
Message 3 of 4
(3,936 Views)

I had a similar problem with the Excel instance in the task manager after calling ExcelRpt_ApplicationQuit.

For my case, I have multiple worksheets in the workbook and I periodically log some data in them.
But, I have a single worksheet handle variable.
After I am done writing to a worksheet I had to discard it using CA_DiscardObjHandle before getting the handle of the next worksheet into the same variable, otherwise Excel stays in task manager.
If I discard all the worksheet handles and all workbook handles properly, the Excel instance in task manager disappears only after calling CA_DiscardObjHandle for the application handle.

One should call CA_DiscardObjHandle for the workbook and app handles after you call ExcelRpt_WorkbookClose and ExcelRpt_ApplicationQuit.
The reverse would be meaningless. Any ExcelRpt call with an invalid (dsicarded) handle would generate an error I guess.

Hope this post shines some light on the issue..

S. Eren BALCI
IMESTEK
0 Kudos
Message 4 of 4
(3,713 Views)