LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Close ActiveX reference after converted with VariantToData

In this vendor example vi an Invoke node returns a reference to a Worksheet page.  The reference is converted using VariantToData to another (internal) type.  My question is a general one: can the final "Orgin.WorksheetPage Out" reference be used with a LabVIEW Close Reference vi or does it need to be converted back to the original type (Origin.WoksheetPage) that came from the Invoke.Item call?OriginLab Close Worksheet Reference.png

0 Kudos
Message 1 of 6
(3,388 Views)

The original type is actually an array of WorksheetPages, which is being indexed by name to pull out that specific page reference.  You should just be able to close the reference as is.

aputman
0 Kudos
Message 2 of 6
(3,357 Views)

Ok. Does the WorksheetPages reference (going into the Case statement) also need to be closed explicitly? The IOApplication Refernce passed into the first Property Node is being closed (not shown).

0 Kudos
Message 3 of 6
(3,354 Views)

It doesn't hurt to close it, as long as you are actually done with the reference.  It's good practice to close any reference that is opened.  I can't say for sure what happens if you don't close them.  I would assume, at some point they would be cleaned up when Labview or Excel (assuming these are Excel references) are closed.  

aputman
0 Kudos
Message 4 of 6
(3,333 Views)

I have tried to explicitly close both "Origin.WorksheetPage Out" and "WorksheetPages" references. Note that prior to calling this vi, there is an Automation Open.vi call that starts an Exe and produces the incoming Origin.IOApplication reference. So, despite explicitly closing both the reference generated in this vi, something about this VI that prevents the Exe from closing. I have proven this because if I omit this vi, then the Exe terminates properly (as witnessed in Windows Task Manager).

0 Kudos
Message 5 of 6
(3,309 Views)

The item refnum that is being converted by the Variant To Data vi should also be closed. If you put a probe of the wires coming in and out of the Variant to Data vi you will see that the refnum have different value. The IOapplication reference should also be closed before exiting the application.

 

Ben64

0 Kudos
Message 6 of 6
(3,299 Views)