LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with Excel and ActiveX

I am new with working with ActiveX, so I need some help regarding writing to a spreadsheet. Here is what I need to do:
 
1.The user weighs a product on a scale.
2.The user presses the weight button control in labview to retrieve the weight via serial port.
3.The value gets written into a spreadsheet, starting at D2.
4. User weighs the same product after use to get a new weight.
5. labview goes through the same process, but this time it gets written to E2.
6. Differential is calculated (still debating on having the user do this in Excel instead of Labview, since they have to set up a spreadsheet outside of labview for other info not related
to weight).
7. User close labview when finished.
 
The serial comm and all is fine, but the problem I am having is trying to get a specific cell value written in D2 and then getting another value to be written in E2. For example, initial weight would be D2 and post weight would be E2, and then differential would be F2. For the next product, it would be D3, E3, F3, and so on. What would be the best way to implement this? It looked as if ActiveX would be the only real way to tell Excel where to put the data, but there is still alot I have to learn in where to find and use the proper nodes to complete the process.
 
Thanks,
Jody M.
The Procter and Gamble Co.

Currently using LV2018.
0 Kudos
Message 1 of 5
(2,955 Views)

Hi z2830than,

see the attached example. It make following things: open Excel, create new Workbook, ..., write Data to D2, save Workbook and close Excel.
Hope it helps.

Mike

0 Kudos
Message 2 of 5
(2,949 Views)
You should also check the examples that ship with LabVIEW. There are several that deal with Excel using ActiveX. There is also the Excel "board".
Message 3 of 5
(2,944 Views)

Mike S81, that helped me out alot! Just one little issue I have and I should be able to get it modified to incorporate into my VI. I am trying to get it to where it will append a file value instead of overwriting the info each time I press the weigh button. I thought I saw the problem in a true/false constant in the Save Worksheet sub-VI. However, that didnt work.

 

Thanks again,

Jody

Jody M.
The Procter and Gamble Co.

Currently using LV2018.
0 Kudos
Message 4 of 5
(2,923 Views)

I figured it out 😄

I had to change the invoke node in the New Workbooks sub-VI to open the file instead of adding a new workbook each time it was called up.

Thanks again for your help!

Jody M.
The Procter and Gamble Co.

Currently using LV2018.
0 Kudos
Message 5 of 5
(2,915 Views)