From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel object memory problem

Hi all
I'm have some problem with Excel ActiveX object memory cleaning.
There is LabVIEW example that open Excel, add new sheet, write some values and closed. There are not any problems.
I maked litle changing in vi that open sheet: it get as input the number of sheet that i want to open. If this sheet founds, vi open it, but if not,  LabVIEW creat new sheet. Now LabVIEW not clean memory. The problem is because there is CASE.
If somebody know how can i clean memory?
0 Kudos
Message 1 of 5
(2,555 Views)
Hello,
 
From what I understand Excel or LabVIEW are leaking memory when LabVIEW is used to automate Excel with ActiveX. Can you please tell me something about how you know that the application is leaking memory? I am also no sure what you mean by, "The problem is because there is CASE", can you explain this statement in a little more detail?
 
Thanks!
 
Have a great day.
 
Scott Y
NI
0 Kudos
Message 2 of 5
(2,538 Views)

The quickest way of identifying this problem is if you could post the VI that you are working on.

Mike...

 


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 5
(2,532 Views)

Hi, thanks about your post.

About your question how i know that there is memory leaking problem - i look in Task Manager and see that excel running after closing it.

"Case" - i mean LabVIEW switch structure that include number of cases. I have 2 "cases", each of them include creating Excel object "Sheet", but really only 1 of them created.

Please look attached llb. This is NI Excel example, but have 1 changing: in VI that open new sheet i added case that include 2 identical cases, just for understanding where is a problem.

0 Kudos
Message 4 of 5
(2,528 Views)

Ok, the code is doing exactly what it's supposed to be doing (almost--there is still a real memory leak issue, but we'll get to that in a moment). There is a font panel control called Completion Task that has the default value "Leave Excel Open" so you it leaves Excel running--you're telling it to.

Now having said that, there is still a problem. The only time that LV's Application and WorkBook RefNums are closed is when you close the application. The two close nodes need to be outside the final case structure so the references get closed regardless of whether the program is left running.

Mike... 


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 5 of 5
(2,522 Views)