LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing to Excel on demand problems

I'm trying to develop a simple application that queries the serial port and writes the result into Excel, when the user presses a command button.  And that simple application is kicking my buttSmiley Sad  I'm having trouble writing to Excel, the first write goes fine but all consecutive writes fail.  I get an invalid input error after that.
 
I would appreciate if someone could take a look at my VI and help out a struggling LabWindows guy, yet determined to do this in LabView guy.  Hopefully it's an obvious problem, other than go back to LabWindows and try again...Smiley Very Happy
 
It's in LabView 8.0.
 
Thanks for your time and help!
 
 
0 Kudos
Message 1 of 6
(3,183 Views)
allo!

i have had a quick look at your vi.

you do not have the code in a loop, so it executes only once just as it is supposed to.
try putting a while loop around the code that has to be run multiple times and using the stop button on your front panel to stop the loop when you are finished.

regards
John
0 Kudos
Message 2 of 6
(3,172 Views)

Hi John,

Thanks for taking a look at my code.  I think my problem lies in how I handle my reference numbers for Excel.  I'm looking to just take one reading and dump that value into Excel, so I don't think I need any loops.  I may be wrong. 

I think it's how I open Excel in one structure, and then write it to a local variable, and then I read that variable in another structure.  There seems to be something basic that I'm missing, and I'm not sure what it is.

 

Thanks again!

0 Kudos
Message 3 of 6
(3,168 Views)

GoBlue,

I checked out your code and it looks like that it very well could be the local variables that are causing your issues.  I would try to take out all of the sequence structures that you can and use the error clusters on your subVIs and property nodes to enforce the sequencing that you would like.  This would eliminate the need for the local variables as well, and make your program easier to read, which usually helps when finding errors. 

Hope this helps!

Andy F.

-----------------------------------------------------------------
National Instruments
Message 4 of 6
(3,138 Views)

Hey Guys,

I figured out what John was saying to do with the while loop, and that works good.  I see my LabWindows logic needs to change for LabView.  Thanks John!

It was definitely the local variable screwing me up, I got a basic Excel write VI working, then I broke one reference number line and placed a control and a variable in the path, and sure enough it didn't work after that.  I'm sure there's a reason why, I just don't know it.

Does anyone know why the local variables don't work in this situation?
 
Thanks for your help.
0 Kudos
Message 5 of 6
(3,116 Views)
How was it not working when you broke the wire?  Did it just not do anything?  The ActiveX functions are very particular about the references that they need and it may be that you disconnected a crutial one.  It is difficult to tell without the code.  The local variables can work, but they do tend to cause some issues due to race conditions.  It definately takes a little bit of retooling to go from CVI to LabVIEW (and vice versa). 

Hope this helps!
Andy F.
-----------------------------------------------------------------
National Instruments
0 Kudos
Message 6 of 6
(3,103 Views)