LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Close Excel File after getting data from it

Hi!

I have a big vi to make data aquisiton from a spectrometer. I have the aquisition part and the "save to spreeadsheet" part also. Now I want to make a button to open the data from the excel file and show it in a xy chart. I had some problems but now its working except one important thing. After I read the data from the file and have it in the chart, it seems like the file it's not closed cause if I try to open it in excel, it "hangs" the computer. If I stop the vi, there's no problem. What can I do? I saw here in the forum that its not necessary to open or/and close spreedsheet files but i think this problem is because the file it's not "released" or something. Any help would be great.

Here's the part of the vi that reads the file, and the file itself.


Thanks in advance
0 Kudos
Message 1 of 12
(4,296 Views)
post in ur vi... i cudnt see any attachment in ur previous msg..
0 Kudos
Message 2 of 12
(4,289 Views)
Strange. I made the attachment. Anyway, here it is:


Download All
0 Kudos
Message 3 of 12
(4,284 Views)
Can anyone help? I cant solve this problem Smiley Sad
0 Kudos
Message 4 of 12
(4,271 Views)
The sysptoms you describe are a direct result of Automation references left open.  It is critical that you close every ActiveX reference that you create when you no longer need it.  This includes the Application, Workbook, Worksheet and all of the Range references used.  When you have correctly closed all references, this problem will disappear.
Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.1, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
0 Kudos
Message 5 of 12
(4,259 Views)
First, thanks for your answer.

As I said in my message, I tought it was something to do with that but, maybe i'm wrong, but using the "write to spreeadsheet" vi it means i'm using an ActiveX reference?

Anyway, in that example, i open the file, i see the graph and i think at the moment i see the graph, the file it's not being used! What do you mean by "close the Application" Do you mean, excel, for example?

I made a debug and, after i see the graph, the vi keeps asking for the value of the "open data file" button and it's false. The file should be "free" to be opened in excel.

Sorry for my English, it needs pratice...
0 Kudos
Message 6 of 12
(4,256 Views)
Zephirus,

I downloaded your files and was unable to duplicate the problem.  What version of LabVIEW are you using?
0 Kudos
Message 7 of 12
(4,249 Views)
Labview 8.

I tried again to open the file in the vi and the without stopping the program, open it in excel and it's very slow but a little while after, i can. it really seems like its in use...

Message Edited by zephirus on 06-29-2006 01:20 PM

0 Kudos
Message 8 of 12
(4,244 Views)
It also worked for me. While the VI was running, I was able to open the data file in OpenOffice. Could it be something about the file permissions?

Use of the Mechanical Action: Latch When ... will eliminate the need for the local variable to reset the Read boolean. Use of the event structure reduces CPU usage on loop iterations which do nothing. See attached modifications of your VI.

If you select "Preview Post" after attaching a file, the attachment gets lost.

Lynn
0 Kudos
Message 9 of 12
(4,240 Views)
Wow!!! Great Smiley Surprised

It works!

I have just one question: the button is set to "Latch When Released". If I put a button with that type of mechanical action, the button remains pressed right? So, in this case, how does the button goes to its initial state again? I don't understand the mecanism that makes that.

About the attachments, i didnt know that, but in fact i really did a preview 🙂

Thanks
0 Kudos
Message 10 of 12
(4,232 Views)