05-28-2013 09:22 AM
hello,
I am pretty new to labview and I am trying to add an event to someone else's code. I want to say "when certain excel file is read, add this specification". When I looked at the options for events I saw that you could do a 'value change' but I need it to be when a certain file is read. I cannot post any code but if someone could give me a general explanation that would help.
Thanks all
05-28-2013 09:32 AM
This is one of those times a User Event comes in handy.
This example is obviously not ready for prime time but should give you an idea of how to start
05-28-2013 09:35 AM
Your application is using either ActiveX or .NET to interface to Excel. The Excel API exposes certain properties, functions and events you can use in your application.
Depending on the situation you want to react on, there is either an exposed event or you have to poll the property. If the event is exposed, you wouldn't use the event structure in your LV code, but you would "register for event" and define a callback VI there.
hope this helps,
Norbert
05-28-2013 12:25 PM
Thank you for the help, but I am a little confused still. I am fairly certain Activex is used but I cannot find where the differentiation between excel files is made in the code. So basically I do not know if the information I need is given or if I have to extract it like you said. I do not know how to extract the ref num or how to reference the file. Sorry that my understanding is so basic.
05-28-2013 03:33 PM
I'm not certain I understand your question. If you have code that opens and reads Excel, and want to "do something" when that happens, simply put the "do something" code wired right after the "open and read Excel" code (if you put everything into a sub-VI, you can have a "Read Excel" sub-VI followed by a "Do Something" sub-VI, connected by wires to enforce Data Flow.
On the other hand, if you are asking "How do I open and read Excel spreadsheets in LabVIEW", the answer is "Use the Report Generation Toolkit", which hides most of the pain and horror from you. And it even works!
BS