LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to open a specific excel file by activex & overwrite by set_cell_value.vi

I've seen the 'Write Table and Chart to XL.llb', but how can i open an existing excel file/workbook/sheet and rewrite some of the data instead of open a new worksheet everytime? It may already shown in your examples somewhere, but since I'm new to activex/property node stuff, I can't figure it out. Your help is appretiated.
Thanks

Anthony
0 Kudos
Message 1 of 9
(4,490 Views)
The process is very similar. Starting with the example, open the diagram and you'll see a VI labled "Open Book" (The name of the VI is actually "Open New Workbook.vi". Right click on it and select Replace/Select a VI...

Now navigate to \\Labview 7.0\examples\comm\excelexamples.llb and select the file "Open Specific Workbook.vi". This VI has an input for specifying a filename to open.

Likewise, the example also calls a VI named "Open a New Worksheet.vi" replace that with "Open a Specific Worksheet.vi" (found in the same place).

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 2 of 9
(4,487 Views)
Mike,

Thank you for your reply, but I only have Labview 6.0. I have also search the 'example code library' in NI website, but they're not availiable. So do you know where I can get the example from?
Many thanks

Anthony
0 Kudos
Message 3 of 9
(4,487 Views)
Anthony,
The example Mike is discussing is the Write Table to XL.vi, which is located in the same path for LabVIEW 6.0 and 7.0, just go into your LabVIEW folder and then example etc.

In the llb he mentioned you will find VIs that open specific workbooks and worksheets. Using those VIs you can modify the Table example on a specific sheet.
0 Kudos
Message 4 of 9
(4,487 Views)
Got it, thanks for you help.

Anthony
0 Kudos
Message 5 of 9
(4,487 Views)
One more question, how come there is no control of which sheet to open in the 'open specific worksheet.vi'? I tried to wire the sheets index field with a string control, but it gives me a invalid index error. Can you suggest me a good reference book on activex control stuff in labview please?

Thanks

Anthony
0 Kudos
Message 6 of 9
(4,487 Views)
Anthony,

You will need to wire in a numeric control instead of a string control. Excel is smart enough to allow sheet to be selected by name or by index. If you wire a string, it will assume you are looking for a sheet by that name.

Michael
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 7 of 9
(4,487 Views)
Thank you Mickael!

Anthony
0 Kudos
Message 8 of 9
(4,487 Views)

Does any one know how to get the selected cell index in LabVIEW when you click excell cell?

Thanks.

 

Jim

0 Kudos
Message 9 of 9
(4,287 Views)