I'm new to ActiveX stuff, but eager to learn! :smileyhappy:
The "grrr" in my Subject line is a reference to how I feel about LabVIEW's documentation from time to time. I'm a dinosaur who came from text-based programming, and did a fair amount of C coding, so sometimes with LabVIEW I'm left with this awful feeling in the pit of my stomach like, "Good grief! How much memory must LabVIEW be hogging up in the background when I use this vi?" or "What happens to those variables (wires) in that subVI when it completes but doesn't close? What are their statuses when I come back in the next time?" or "What if I put a lot of elements into that array the first time and then started from element zero the second time and just put in a few? What has happened with the memroy that was allocated when there were a lot of elements?"
Today I'm stewing about this "Excel Get ActiveX References.vi," and what happens to the "ActiveX references" it generates each time I call the subVI in which "Excel Get ActiveX References.vi" lives. I think that at least one of the "ActiveX references" it generates when I call it is of the type Excel._Application. Then there appears to be an Excel._Workbook, and others. You see, I've used "Excel Easy Report.vi" to put some data into an Excel spreadsheet, and I want to tell Excel to do a "Save" on the open spreadsheet. I think ActiveX is the (a) right way to do that, so I'm wading into the ActiveX fray... But this "Excel Get ActiveX References.vi" says in its help file, "Do not close ActiveX references opened with the Excel Get ActiveX References VI. References must remain open until the report is closed. Otherwise the error 3001 will occur." Well, these Excel workbooks that get created by my VI could well stay open until after my LabVIEW VI terminates!
So (finally), here are some of my quesitons:
1) When I go through my subVI once, pointing to one workbook, I'll get one set of references "created" or "opened" or whatever you call it when ActiveX references spring into existance. Now, when I exit the subVI, is it going to automatically try to "close" those ActiveX references? I don't suppose so, since subVI's stay in memory until the calling VI closes.
2) Now, I come back into my subVI a second time. New workbook gets created, so I get new references. Ok, fine. Uh oh! What happened to those old references? I suppose that if I didn't somehow save them off, I've probably lost the ability to get them back (maybe I'm wrong, but I don't need them back), but is LabVIEW going to "close" those old references (from previous times through the subVI) because I can't get to them anymore? Won't that cause the dreaded error 3001? If LabVIEW is not going to "close" them, what in tarnation happens to them (the old C programmer in me creeping back out)?? Now it's some oddball, orphaned reference, floating out there, hogging memory, waiting to make something crash intermittently and be a debugging nightmare?
3) Now, here's the real scary one. I think I might dodge the "error 3001" bullet in questions 1) and 2), but now let's say the user closes my LabVIEW application while Excel is still open. All those workbooks are still open. Presumably, all those ActiveX references I was not supposed to close are still open. I really hope that LabVIEW is decent enough to close/erase/delete/blow-away (whatever the right word is) all those ActiveX references which were opened/created by "Excel Get ActiveX References.vi" when my program terminates. But, oh no! Won't the error 3001 come along then? I suppose I can just dump it in the shutdown error handling.
Well, thanks for reading my novel. I don't know what can be done with LabVIEW documentation to make it more satisfying to folks like me, but perhaps someone can weigh in on all my ActiveX questions here.
Thank you in advance,
Steve Brady