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.
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.
03-06-2017 01:29 PM
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?
03-06-2017 02:39 PM
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.
03-06-2017 02:52 PM
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).
03-06-2017 04:57 PM
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.
03-07-2017 08:11 AM - edited 03-07-2017 08:19 AM
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).
03-07-2017 09:47 AM
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