LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I detect open applications using LabView 6i

I am using ActiveX to open and write data to an Excell spreadsheet. I open a Template sheet, fill in the new data, then save the spreadsheet under a new name.

I have discovered that if excell is already open when the VI starts, the spread sheet does not get saved under the new name, and the data ends up being saved with my template worksheet.
I need a method of determining if Excell is open and if so close as part of the VI's startup routine.
0 Kudos
Message 1 of 4
(2,824 Views)
You can use the "ActiveWindow" method on the "_Application" node to see if it returns a valid refnum or not.

A valid refnum tells you Excel is open, an invalid says it's not.

Sample attached.

Ed


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 2 of 4
(2,824 Views)
Hello Kandrew

An option is to use the "get task list.vi" which you can find in this very useful library:
http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B45EACE3EF4556A4E034080020E74861&p_node=ZONE&p_source=external

The VI gives you an output of the Tasks which are running. You have then only to check if Microsoft Excel is in this list.

Hope this helps

Luca
Regards,
Luca
Message 3 of 4
(2,824 Views)
Ed;
Thankyou that was exactly what I needed.
I knew it had to be something simple, but as you know trial and error with activeX can be very frustrating.
One of these days I'm going to talk the higher ups into purchasing the MSoffice tool kit, and maybe even updating me to LV7.

Thanks again great help
Keith;
0 Kudos
Message 4 of 4
(2,824 Views)