08-24-2017 10:40 AM
All,
I have a question regarding Closing Excel. When using activex and closing excel i am still left with the instance of that file in task manager. Eventually they add up and become a memory issue with the computer. I believe i have all of my references closed at the completion of the code. Is there a way to check what references are left open? Thank you!
Solved! Go to Solution.
08-25-2017 04:14 AM
It's difficult to spot the missing function in your "invisible", un-posted code. My guess is you have a New Report, but no corresponding Dispose Report function. If you posted your code, I would not need to guess ...
Bob Schor
08-25-2017 09:39 AM
Bob,
I can post my code, but its alot of different VIs that peform specific functions on a report I create using RGT such as chart creation, editting of series, addition of textboxes etc. I can attach the VI that shows my RGT as well as my VI that contains all the ActiveX VIs. Unfortunately you probably wont be able to run them outside of my project. To be more specific about my problem, this "instance" is a background process rather than a running task. When my executable is stopped, the background processes then close completely.
08-25-2017 11:30 AM
OK, I can at least see in your Format Excel Graphs that you Dispose Report, which stops Excel, but you then call two other functions (only one of which were included in the Zip file) which again calls on the RGT to operate on the same File. [Not sure where/how the Excel ActiveX functions are used ...]. Some comments:
I'm also a little confused. Your initial report seemed to imply Excel was still running when you finished, but now you say you are talking about a "background process" that stops. So what is the problem?
Bob Schor
08-28-2017 10:03 AM
Bob,
I will try your suggestion about disposing of the report and adding a delay. As you probably could see in the RGT vi im just using a template and writing data to it and saving it as a new file. The activex vi's in the 'Excel ActiveX' zip i attached is mostly formatting etc. I reopen the file, create charts from the data, format the charts/series, add textboxes, and then save and close the file.
Now for me to better clarify my problem. I initially misspoke when talking about the task manager. Each time i run a test and create an excel file, there is an instance left running as a "background process". The task itself is no longer running but lets say i run 20 consecutive tests, then all of a sudden i have 20 instances of excel running as a "background process" Once labview is closed all of those background processes disappear.
08-28-2017 10:41 AM
Thanks for clarifying. I just ran a test -- I have a LabVIEW routine that I point at a set of Experiment Data stored in a Directory Tree -- the sub-Folders correspond to different Runs (there are about a dozen of them) and each Run has data from three Stations. My routine opens each Run folder, gathers data from the three Stations, then creates an Excel WorkBook with three WorkSheets, Station 16, Station 17, and Station 18 (those are the Station names), filling each Sheet with "Event" information gathered from files in the Station Folders, with 10-200 Events/Run forming the Rows and 8 Event Parameters forming the Columns. For each Run, there's a sequence of New Report, create and populate the WorkSheets, Save Report to File, Dispose Report, and Delay (I just checked my code -- I delay 100 msec before Dispose Report and 500 msec after Dispose Report).
When I run this and look at the Task Bar, I do see an Excel Icon, but as each Report is Saved and Discarded, the Icon goes away, coming back with the next Report, and being gone when the program finishes. I'm running it in Development Mode, but have no doubt it would do the same thing as an Executable (I'm willing to try, if you need further confirmation ...).
Bob Schor
08-29-2017 03:13 PM
Bob,
I did as you said and I was able to pinpoint the "instances" to after I reopen the file using ActiveX. Keeping in mind with what you had said about saving and disposing after everything is completed, I made some changes and kept the excel file open through opening the template, writing data, data formatting, chart creation, and chart formatting and then closed it at the very end. No instances were left open in task manager anymore! I appreciate your assistance in helping me work through this.