LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel Macro problems

I have Labview 8.2.
 
What I am trying to do is create an excel called XXX.xls.  In that Excel file, I want to create muliple sheets called X1 X2 X3 and so on.  I looked at the example, but could not find anything that will allow me to open the excel file and insert the names that I want to call each sheet.  It only creates one sheet called that same thing as the file name.  Can labview do this, or do I have to open that file each time and can only create one sheet at a time?
 
Next, when I write my data to the sheet, I have to shut the program off, change my condition and start the program back up.  When doing so, it reopens the file, but deletes the data.  Is there selection that will allow me to append to the file rather then deleting what's in the file after reopening?
 
Thanks,
Travis
0 Kudos
Message 1 of 4
(2,706 Views)
Not sure which example you're referring to. That said, programming something like Excel is a pain in LabVIEW due to the ActiveX interface. Your programs tend to get very wide and you're tossing around references on the block diagram like spaghetti <insert Homer Simpson sound here>. The first part of what you're asking basically involves opening Excel, opening a new workbook, and adding sheets if the number of sheets you want is greater than 3, which is the number of sheets Excel automatically adds when you create a new workbook. The attached VI should get you started to give you an idea of what you need to do.
0 Kudos
Message 2 of 4
(2,695 Views)

I dont even get the 3 sheets that comes up.  It only gives me 1.  But I'll work with this file and see if I can give it the number of sheets I want.

Any ideas on how to keep the data in the file even after I close the excel file and reopen it back up?

 

Thanks,

Travis

0 Kudos
Message 3 of 4
(2,691 Views)

Hi Travis,

Can you please give more details as to what is not working with this VI?  When I run the VI, it creates the file I request, with the correct number of sheets that are named as specified in the VI.  In fact, it even saves the VI in the location that I specify.  I believe that this VI does accomplish what you are trying to do.  If I have misunderstood your question in anyway though, please do not hesitate to clarify by reposting your issue on this forum.

Best of luck on your application, and have a great day!!

Regards,
Ching P.
DAQ and Academic Hardware R&D
National Instruments
0 Kudos
Message 4 of 4
(2,675 Views)