Example 1: MS Excel
In this example, an output value from an input field is written in an Excel table.
‘VBS113
Dim objExcelApp
Set objExcelApp = CreateObject("Excel.Application")
objExcelApp.Visible = True
‘
‘ExcelExample.xls is to create before executing this procedure.
‘Replace <path> with the real path of the file ExcelExample.xls.
objExcelApp.Workbooks.Open "<path>ExcelExample.xls"
objExcelApp.Cells(4, 3).Value = ScreenItems("IOField1").OutputValue
objExcelApp.ActiveWorkbook.Save
objExcelApp.Workbooks.Close
objExcelApp.Quit
Set objExcelApp = Nothing
——————————————————————
根据以上几个例子做的就是要打开关闭。希望的是EXCEL文件一直打开同步显示WINCC数据更新。
其实目的就是实现excel和wincc的数据同步更新。OPC在server 2012R2 下能走通最理想,后面这个方案是退一步方案,因为占用全局脚本进程,导致程序变慢。看网上有网友说在WIN7环境下EXCEL OPC读取WINCC也遇到问题。