Closing references ActiveX

Hi all

I'm just starting to work with ActiveX controls.  The attached graph shows a loop that opens different spreadsheets Excel in a workbook, based on the user's selection.

My questions are:

1 - is the 'Data Variant' create a new refnum whenever it runs?  If so, then I have to move the function of 'Closely Reference' associated inside the loop, Yes?

2. is there a better way to select different worksheets?

Any help would be greatly appreciated.

Thank you

FB

Yes, you must close the reference inside the event, immediately after, you have finished using it.  You could run away references the way that you do now.

I see no problem with this method of selecting a worksheet - is there a reason any you don't like it?

EDIT: Also, is there a reason you have the Excel._Worksheet as a control rather than a constant of type?

Tags: NI Software

Similar Questions

  • Closing references ActiveX correctly in the Simple user interface

    Hello

    I am currently editing the user supplied with Teststand 2013 Simple interface in order to access the global variables of the station through LabVIEW.  A simple test, I'm trying to access the value of username.  When I run the VI for the first time after the opening of LabVIEW, I get no error message and the program works as required.  Stop the running VI will return no error, but when I try to run the VI and rerun the Teststand, stalls the execution sequence and I get a wait status.  I then have to close running VI by killing all threads in Teststand, I think that the PropertyObjects do not come out properly and I find the structure of the event quite confusing to deal with.

    My attempt to close the references in the while loop looks like this:

    The rest of the program is exactly as expected with Teststand 2013.

    Any input on how to close properly references ActiveX and extracting station globals in LabVIEW would be much apreciated.

    Thank you for your help,

    Christian

    Christian,

    Doug is correct if you open references in a loop, you should also be closing them in the loop. For example, this code open a reference to the engine and the Globals PropertyObject. Two of these references must be closed each time that the loop is executed with the current code.

    You might be able to improve this code is to put your username querying code elsewhere. This username appears as something that would happen only when a user connects or disconnects, then perhaps that this code could be registered as a reminder of the event UserChangedevent. Follow these steps in the VI of reminders set up event of the user interface.

    If you do not need this code to update constantly, you can put in the structure of the event time-out event in your screenshot and fix a reasonable (maybe 100 to 200 ms).

    Hope this helps and let us know if you have other questions about this!

  • Unidentified for reference ActiveX object

    There are objects in the examples following that I can't identify (the program was written by someone else).

    There are labeled WINX32Lib.IExpSetup and pFile on the block diagram. There's obviously static ActiveX references, but the contextual help of Labview said "no description available".
    What do these, and how to create them in the palette of functions?

    calvintiger wrote:

    They were in fact part of the Winview (used for scientific CCD cameras).

    Do you know how to create these items on the block diagram?

    I admitted little knowledge or not and you think I can help it Fund?

    I'll take the complement and offer what I can in Exchange.

    Start by droping a container ActiveX on the FP.

    Right click and find an option to navigate (or something like that).

    There may be an option to "Create from the document" available for ActiveX stuff.

    In the case of navigation find something that looks like what you want (with the help files you will have to explore).

    After choosing the AX thingy, go to the BD and start adding nodes of property or invoke nodes and see what you find.

    I don't know if this will help. That's what I would do if I found myself trying to create code using undocumented stuff AX.

    It would be interesting to link to serach for help on the web for the AX.

    You COULD also just drag the code that you have demonstrated a new schema and there is.

    Made with the specualtion!

    Have fun!

    Ben

  • If an application includes references ActiveX from Excel, MS Office must be installed on the PC to run?

    There are a lot of discussions about the use of MS office with LV, but I wasn't able to find the answer to the next question. I hope someone can help or point me to a good thread.

    I have an excel template file and want to create reports every time him. There are a few solutions to this problem, which are very good. But, in the end, I'm going to build an application and install it on an industrial PC which doesn't have MS office installed. The question is whether the application runs on the target computer as well.

    I am specifically geared towards the solution here that uses ActiveX reference to Excel._Application. Target no chance that this solution or any similar work on my computer?

    If you're wondering why I want Excel reports on a computer that does not have MS Office, I must say that the reports are simply stored somewhere on the disk to be transferred later to the seat say!

    Development of machine: Win7, LV8.6 Pro + report generation toolkit

    Target machine: WinXP SP3, engine of execution of LV

    Thanks in advance!

    Soroush

    You must have Office installed on the computer that is running the LabVIEW application. It's the Office applications that provide the ActiveX functionality in the report generation tool. Without them, LabVIEW has nothing to interface to.

    http://digital.NI.com/public.nsf/allkb/02E339E26484F30186256E920061FBD9

  • Closing references

    It is necessary to close a command tree explicit reference? The following code is from the finder example - tree Cross and Set Custom Symbols.vi.

    As a general rule, I'm not closing control references. In general, unless I open a reference (most often a file or VI) I don't worry on close. As for an explicit reference, as shown here, close seems ridiculous. As time passes I close the references less and less.

  • closing references - what

    Hello

    I have a small question on the fence of the references.

    When writing some programs I open usually refers to a single store location in a shift register or fgv and the usewhen I need as in case 1. Then I close the reference to the output of the application so leak memory will not happen.

    I wonder why the case 2 works fine. I opened reference used and then closed. So property where I write 1 shouldn't return error?

    Implicit references close not really until the owner VI is closed.  To close an implicit reference won't hurt.  Implicit references to the same control will use the same reference.

  • Get References.vi of ActiveX and references - closing Excel grrr

    I'm new to ActiveX stuff, but eager to learn!

    The 'grrr' in my subject line is a reference to how I feel about LabVIEW documentation from time to time.  I'm a dinosaur coming from textual programming and did a fair amount of coding in C, so sometimes with LabVIEW, I find myself with this terrible feeling in the pit of my stomach, like ' Good grief!  The amount of memory must LabVIEW be hogging space in the background when I use this vi? ' or 'what happens to these variables (son) in this sub - VI, when it ends, but does not close?  What are their articles when I come back in the next time? ' or ' what if I put a lot of elements in this array, the first time and then started from 0 the second time and just put in some?  What happened with the memroy that has been allocated when there was a lot of elements? »

    Today I am steaming on the subject 'Excel get ActiveX References.vi', and what happens to the "ActiveX references" it generates whenever I call the Subvi in which lives «Excel get ActiveX References.vi»  I think at least one of the"ActiveX" it generates when I call it is of type Excel._Application.  It then seems to be an Excel._Workbook and others.  You see, I used "Excel Report.vi easy" to put some data in an Excel spreadsheet, and I want to tell Excel to do a 'save' on the worksheet open.  I think that ActiveX is (a) the right way to do it, so I'm wading into the fray ActiveX...  But this "Excel get ActiveX References.vi" said in its help file, "do not close references ActiveX opened with references to ActiveX Excel Get VI. The references should stay open until the report is closed. If not, will the 3001 error. "Well, these Excel workbooks to be created by my VI could stay open until after my LabVIEW VI ends!

    So (finally), here are some of my questions:

    (1) when I go through my sub - VI once, pointing to a workbook, I'll take a set of references 'created' or 'open' or whatever you call when ActiveX references spring into existence.  Now, when I leave the Subvi, it will automatically try to 'close' these ActiveX references?  I don't think that, since the stay of Subvi in memory until the appellant VI closes.

    (2) now, I'm back in my Subvi a second time.  New workbook is created, if I receive new references.  Okay, all right.  Uh oh!  What happened to these old references?  I suppose that if I did not save somehow off, I probably lost the possibility to recover them (maybe I'm wrong, but I don't need their return), but is LabVIEW go to 'close' the old refers (from times past through the Subvi) because I can't go to them more?  Which will not cause the dreaded error 3001?  LabVIEW is wrong to 'close', what in tarnation is happening (the old C programmer in me creeping back)?  Now, it is some oddball, reference an orphan, floating there, hogging memory, until we do something to crash intermittently and be a nightmare to debug?

    (3) now, here's the real fear.  I think I could dodge the bullet "error 3001" questions) 1 and 2), but now we will tell the user closes my LabVIEW application that Excel is always open.  All of these workbooks are still open.  Without doubt, all these ActiveX references that I shouldn't have to close are still open.  I really hope that LabVIEW is honest enough to close/delete/remove/blow-away (no matter what the right word) all of these ActiveX references that were opened/created by 'Excel get ActiveX References.vi' when my program ends.  But, oh no!  The 3001 error only then will come along?  I guess I can just discharge it in the stop error handling.

    Oh well, thanks for reading my novel.  I don't know what can be done with LabVIEW documentation to make it more satisfying to people like me, but maybe someone can weigh in on my questions ActiveX here.

    Thank you in advance,

    Steve Brady

    Here is the diagram of Excel get ActiveX References.vi:

    No matter how many times you call this VI, returned references are always the same. So call this VI in a loop has no effect on memory, performance, etc.

    The reason that you are not supposed to close these references is they are stored internally to your reference report (as part of the data class) and are used by the other screws in the API report generation. These references must stay open until you're appealing report Gen screws, how you must call Report.vi have as the last VI in your 'chain '. Have Report.vi looks like this (for the Excel application):

    That's where these references are closed. You should always call Report.vi has to ensure that all references ActiveX used by this particular report object are closed. If you do not, then it is the possibility for them to be kept in memory by LabVIEW, although the VI will idle. LabVIEW is capable of auto-éliminer certain types of reference when screws become inactive, but I don't think the ActiveX references are one of these types.

    Let me know if you still have any questions. Generally speaking, the report Gen screws should provide all the features you need to handle your report... the screws Get ActiveX references are only for the case where you need to do something the report Gen screws do not allow you to do.

  • Should I close the reference?

    Hello

    I would ask... should I close the reference of the workbook in the following code?

    In fact, I have little idea whether to close a reference or not, because I thought that LabVIEW will automatically close all references after the execution.

    I also found that someone says that the activeX references must be closed on mine.

    Could someone correct my understanding of the closure of reference?

    In this case I'm fairly certain that cleaning screws will close these references, so I don't think that you should close your self.  One way, usually, I test this is I put the code in a while loop, or use the continuous run button.  It's basically the only time wherever I never use only and I have on small subVIs like that.  Then, I run my code over and over again and look at the Task Manager to see how much memory is using LabVIEW.exe.  After a few seconds if there is a leak of memory then memory will continue to increase.  If the memory goes up and down a bit, but overall does not continue to grow, then all the references that should be closed are closed.

    There is a white book NOR on the reference Server VI of closing which is exactly what you are doing, but has relevant information.

    http://www.NI.com/white-paper/14393/en

    And an exchange of views on this subject.

    https://lavag.org/topic/16443-closing-references-in-LabVIEW-new-documentation-published/

  • Close the reference (for a more specific class)

    I'm feeding a control reference to the node "to a more specific class.  When I finished, I understand that I have to close the order, but what I also close the reference that is the output of the node "to a more specific class?

    This is the same reference... There is no need to close the two.  And if you approve the automatic cleanup of references LabVIEW, you really do not need to close, as the references control must never be matched and will be automatically cleaned when your VI is inactive.

    For more information, here is a blog that just now, I wrote that talks about closing reference.

  • detection of reference and/or other input types

    I have a situation where I want / wish to detect what kind of reference activex is a special and then output reference that reference type to another part of my code.  Is this possible?

    I could / would also make great use of some code allowing to detect what the entry is.  I mean here the numbers (I8, U32, DBL, CXT...), strings, references, paths, or boolean.  Is this also possible?

    I realize that polymorphic screws may be an answer, but I don't have the ability to create them.  Please, is there other ways to achieve my goals?

    James

    The OpenG Toolkit has a function called Get Data Type Enum

    Tone

  • FP. Closing does not close application.

    When I use FP. Close in my main vi, which is the last step in my code, it stops the program, but does not close the front panel.  Although the program has stopped running, the front remains open.  I would avoid this because operators think it is still ongoing.

    -Thank you

    Well, I can not help with you feel, but you have to QUIT LABVIEW in an application.

    No matter HOW you exit you should not do before closing references, files, connections, etc.

    Once you have done all that, then it's time to LABVIEW to quit SMOKING if you are in an application.

  • gone 3D reverse chart axis option

    I want to programattically must reverse the axes X and Y of a plot 3D to answer the orientation of my installation. In older versions of labview, it was possible but now in 2013, this option seems to have disappeared. 2013 using a function called is mentioned "axis: range: range inverted", but he's not here.

    He returned in a new update soon?

    Kind regards

    Martin

    Hello Martin,

    I'm glad that you were able to locate the property. The difference between the 2 garphs is that the 3-d chart of Surface (using) uses ActiveX and is supported only on Windows OS. The other chart (which I used) looks more like a native control of LabVIEW. The differences are detailed here.

    I don't know why the axis reversal property is not exposed, or if it will be in future versions, but here is a quick work around. Place a container ActiveX on your façade. Right-click on it and select Insert ActiveX object. In the dialog box that pops up select CWGraph3D control. This should give a similar 3D-graphics on your front, you're used to using.

    On the block diagram, you will get a 3-d chart reference ActiveX. That you can use to manipulate the graph using 3D graph properties screws (range of functions > programming > graphics and sound > 3D graphical properties). To invert the axis, you can do something like this.

    If you notice the data that you provide to draw remain same in your approach and this workaround.

    I hope this helps.

    Kind regards

    Michel

  • Sorensen XG 60-14 error

    Hello

    I have a problem with a programmable power recently bought Sorensen XG 60-14. In my application (LabView 2012), I use this power to fuel a cooler through regulation PID Peltier. My code sets the current performance of the PSU to the all the 1 sec. My application works without any problem for days, until like 4-5 days, and then I get a crash.

    The first problem is that, when I get the error, the LabView gives a pop up window asking continue so or stop? This is really not good, since my code should stop completely in case of error (I wrote my code in a way if there is error, he must close and stop all other material, like other power supplies). I used the official "lvlib" Sorensen to make my own screws, see set in the zip file.

    In my code, I first tried to use the "configure Output.vi" Sorensen VI official with very little modification, but usually, I got errors and accidents after 2 or 3 days. So I decided to get rid of dish-sequence-structure and also unnecessary allow exit on every play, so I set it too.

    Now I use the Output_Sorensen_XG.vi 'configure', and I call it the "Sorensen_XG_psu.vi." So in my high level VI, I call these screws with 1 Hz frequency.

    First, I here insert the photo of the first error that I consider a pop-up error:

    After clicking 'continue', I get the following error, but I guess that the first error above is one, as the following is generated due to closed resources?

    What can be the problem? I created leak memory somehow? I should close some refnums in the Output_Sorensen_XG.vi 'configure' after each iteration, there is a lot of property nodes?

    I hope someone can help me... thanks a lot!

    EDIT: actually, I realized that the second jpg is the info error relevant, since the first is just a mistake of a Subvi, where I try to shut down the power supply in case of error, and that the part is not connected via wire error.

    So the relevant error is second, the "refnum zero or removed ' a. But how the refnum evaluates to null?

    Martins wrote:

    In fact I see only two references: 'Out' and 'system '. The reference called "AmetekXGLib.IAmetekXG" is available as an entrance tunnel and is also in the exit tunnel that you see. When I call the "Sorensen_XG_psu.vi" in init mode, I get this ref, and eventually I simply store in a shiftregister as you can see...

    (1) IAmetekXGOutputs

    IAmetekXGOutputChannel 2).

    IAmetekXGSystem 3).

    4.) IAmetekXG - which you reuse via the shift register

    No closed references cause Excel to continue running in the background that's why I notice them.

  • Sorry for the inconvenience.

    Help!

    I have an application that works ok for a while now and this morning it failed with LabVIEW to crash and burn.

    The error message was the dialogue where it says "LabVIEW 8.6 development system has encountered a problem and needs to close..." »

    I've seen this error message before (instead of stangest), but exclusively in development mode. This error has occurred during the March and after several hours to do the same thing (if something was borked in the s/w that he should have not much earlier). Can a doubtful driver / DLL call give this type of error message? As it happens if I particularly trust PC and PCI single board industrial basket because there are a lot of strange behavior, he.

    Any ideas?

    Thanks for all the suggestions everyone!

    I come from the client and the problem of debugging. It was a really weird error message actually come on the screen while another VI was running (and has continued to work very well, with me able to probe the pattern-block etc.!).

    The culprit was... a TDMS writing! In another loop I closing the file reference and you try to write to the TDMS file using the now closed reference.

    In hindsight, I've seen these types of errors a lot with PDM, when there is a mistake is not exactly a stop appropriate!

  • Change the topology without reference to closing

    Hi all

    I was wondering if I should be able to change the topology of a MUX (reset) without closing the reference?  I have an application that performs a loop on the base initialization, connect, disconnect the sequence for functions OR-Switch and the topology changes for each loop.  I think that my reference is lost, because it becomes invalid after several loops.  I have to close the reference before I reset with the new topology?  I'd rather not have to close every time, because I 'cleansing' steps that close of references outside of the loop. In collaboration with the PXI-2527, LV 2013 and 2013 TS.  Thanks in advance.

    GSinMN

    Ali GSinMN,

    This knowledge base Article should answer your question. The last line reads, "during the change of topology, you close the current session if one is open and reset the map with the selected DriverSetup new.»

Maybe you are looking for

  • My excel is blacked out and cannot be used or removed

    The Excel application has a black icon as if it is updated. However, it it has been a few days, the speed of the WiFi is very good, so I don't think that's the problem. I can't open or delete it. Any ideas? A

  • Installation Windows XP sp1 pack where to find offline?

    I downloaded windows XP SP1a to update my old computer that comes from windows xp. Installation failed because it could not access server. However a message suggested that I get a version that doesn't have an online connection; where can I find this

  • Problem loading sansa e280 after hard drive reformat

  • Wirless B no longer works with Wirless G since encryption

    Finally, I learned how to encrypt my network wireless (for my laptop), but alas, now WiFi b can talk to tivo.  Anyone know the fix to allow B access the encrypted network?  I use WEP 64 bit with 10 digits with SSID wireless disabled.  On the laptop,

  • GVRP and piling on 3448P

    Hello I'm about to deploy 8-9 powerconnect 3448P all switches access in rack 2 different communications. I will be half the number of switches in 2 batteries with each stack having 4 or 5 switches to the maximum. Also there is a possibility of future