LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

excel operation using activex

I am trying to use activex with labview to copy a specific worksheet from a multi-sheet excel file to another spreadsheet file. How can I do this? Any example vi? All my example files are about making a copy within the same file.

Yin
0 Kudos
Message 1 of 3
(3,271 Views)
I have an idea, don't know if it will work!!

Try using a sequence structure in doing this.
1. firstly, open the multisheet excel file and select from it the sheet that you want to copy.
2.Take that worksheet and save it in another temporary excel file with one worksheet (the one u just copied).
3. Now Open the excel file that you want to copy it to and then insert the worksheet you saved temporarily. 4. Delete the temporary excel file afterwards.

Make sure you close all the excel files that you open before you go to the next step.

As I said, this is just an idea, may not work but if you can open, write to, read from and modify excel worksheets then you should have no problems, it should work. Will try and attach something later if no one else helps.
0 Kudos
Message 2 of 3
(3,271 Views)
Yin,
You can use the VI from the following web site
Writing Rows to Excel 97 and Excel 2000 Using ActiveX
The VI allows you to write to a specific worksheet. You can use some of the SubVIs provided to first get a reference to the worksheet in the first workbook, for example SelectSheet and OpenSheet VIs.
Or you can look into LabVIEW shipping examples on Excel, Write Table to XL VI, which also allows you to open specific Worksheet.
Some good examples on how to read from Excel using Activex are located on these web sites:
Reading Values from Microsoft Excel 97, Excel 2000, or Excel XP Worksheets

Write and Read to an Excel 2000 Spreadsheet via ActiveX


Zvezdana S.
National Instruments
0 Kudos
Message 3 of 3
(3,271 Views)