How To Read And Write To Excel Cells From CX-Supervisor IntroductionPlant data can easily be collected by CX-Supervisor, but extra data analysis often requires data to be exported or imported from a spreadsheet like Microsoft Excel. For large amouts of data you can set up Data Logging. To access a few cells of data though you can use a Microsoft ActiveX control to read and write direct to cell values.
MethodBy using a VBScript action (e.g. on a button) you can create an object to access the Excel application and workbooks. The code below creates a connection and then sets the value of a chosen cell. "CellonExcel" and "ExcelSetPoint" are the only CX-Supervisor points requiring definition as text points:
A demo project (saved in CX-Supervisor v3) is also attached showing reading a cell, and viewing the workbook.
For more information on Microsoft's control to access Excel check out the Microsoft web site or try Googling for examples of using CreateObject for Excel for other examples.
Link: |
Comments | ||
|