LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem opening the existing excel file

Hi MR. LV experts,
Please take a look at my example"writetoexcel.VI" . In my example, I can write the data from table to excel. I do not know how to open the existing excel file. And I do not know how to append this existing excel file. One more question is after I save my file, sometime I want to overwrite my file and excel always ask me "DO you want to overwrite" and I do not want excel to display this message. How can I do this? I may need to use property node and invoke node but I do not know. Many Thanks
Saw Naing Aye
Download All
0 Kudos
Message 1 of 5
(3,006 Views)
There are several KnowledgeBases (KBs) on NI's website which demonstrate how to do this. I'm assuming that you are working with the Report Generation Toolkit for Microsoft Office. The following KBs should help you out with this:
Opening Existing Word/Excel Files Using the LabVIEW Office Report Generation Toolkit
Can I Add New Data to an Existing Excel File Without Erasing Old Data?
Those should give you a good start with this.
J.R. Allen
Message 2 of 5
(3,006 Views)
Thanks JRA, but I do not have the tool kit. I modify the example that ship with LV. Thanks for your help. I will try.
Regards,
Saw
0 Kudos
Message 3 of 5
(3,006 Views)
To open an existing workbook, change the Workbooks->Add method to Workbooks->Open and specify the filename there. Then when you close the workbook, set SaveChanges to true and leave the filename unconnected. This should overwrite the previous file with the changes without asking.

The simplest way to append the file is to keep track of the size of the table and add the number of rows to a starting point. Pass that value to the writetoexcel.vi and add it to the row index inside the loop.

If that is not possible, after the sheet is referenced, use the properties Worksheet->UsedRange->Rows->Count. Add 1 for the address of the first blank row.
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.
Message 4 of 5
(3,006 Views)
Many Thanks Michael.
That should work and thanks for your ideas.
Saw Naing Aye
0 Kudos
Message 5 of 5
(3,006 Views)