我想问到的是怎样做能使wincc中的变量数据能够定时导出到exce或者Access中,越详细越好?
最佳答案
用全局脚本每5分钟往里面写数据
Dim fso,myfilep,daystr,dstr,fname
Set fso = CreateObject("scripting.FileSystemObject")
dstr = FormatDateTime(Date,2)
fname="e:\baobiao\" + dstr + ".xls"
Dim ObjExcelApp
Set objExcelApp = CreateObject("Excel.Application")
objExcelApp.Workbooks.Open fname
objExcelApp.worksheets ("sheet1").Cells(i, 2).VAlue = HMIRuntime.Tags("tag1").read
objExcelApp.worksheets ("sheet1").Cells(i, 3).VAlue = HMIRuntime.Tags("tag2").read
objExcelApp.worksheets ("sheet1").Cells(i, 4).VAlue = HMIRuntime.Tags("tag3").read
objExcelApp.worksheets ("sheet1").Cells(i, 1).VAlue =Now
objExcelApp.ActiveWorkbook.Save
objExcelApp.Workbooks.ClosE
objExcelApp.QuiT
Set ObjEXceLapp = Nothing
提问者对于答案的评价:
谢谢你们的回答!
原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc267180.html