资源描述:
《wincc生成excel》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、实用标准文案给wincc中通过vbs写excel的方式做报表的初学者一点脚本我对该帖子不做任何限制,都可以自由拷贝使用。方便初学者学习!//log子程序,40个数据记录,总共记录一周时间,写入excel,放到wincc全局脚本中一分钟运行一次//如果是要整点报表也简单,判断一下当前的系统时间,t的初始值根据当前时间定义。//本程序主要是演示数据记录的过程。//在c:建立一个excel文件,该文件可以是你的报表模版OptionExplicitFunctionactionDimobjExcelApp,objExcelbook,objExcelSheetDimtagshijian,sheet
2、name,username,zhushiDimtagdayDima1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40Dimi,j,t,countDimmsgDimpatch,fnDimd,m,y,oh,mm,ssd=""m="-"y="-"oh=":"mm=":"ss=""msg="记录报表成功"fn=CStr(Year(Now))&CStr(
3、Month(Now))&CStr(Day(Now))patch="c:"&fn&".xls" Seta1=HMIRuntime.Tags("a1")Seta2=HMIRuntime.Tags("a2")Seta3=HMIRuntime.Tags("a3")Seta4=HMIRuntime.Tags("a4")Seta5=HMIRuntime.Tags("a5")Seta6=HMIRuntime.Tags("a6")Seta7=HMIRuntime.Tags("a7")Seta8=HMIRuntime.Tags("a8")Seta9=HMIRuntime.Tags("a9")Seta10
4、=HMIRuntime.Tags("a10")Seta11=HMIRuntime.Tags("a11")Seta12=HMIRuntime.Tags("a12")Seta13=HMIRuntime.Tags("a13")Seta14=HMIRuntime.Tags("a14")Set精彩文档实用标准文案a15=HMIRuntime.Tags("a15")Seta16=HMIRuntime.Tags("a16")Seta17=HMIRuntime.Tags("a17")Seta18=HMIRuntime.Tags("a18")Seta19=HMIRuntime.Tags("a19")Set
5、a20=HMIRuntime.Tags("a20")Seta21=HMIRuntime.Tags("a21")Seta22=HMIRuntime.Tags("a22")Seta23=HMIRuntime.Tags("a23")Seta24=HMIRuntime.Tags("a24")Seta25=HMIRuntime.Tags("a25")Seta26=HMIRuntime.Tags("a26")Seta27=HMIRuntime.Tags("a27")Seta28=HMIRuntime.Tags("a28")Seta29=HMIRuntime.Tags("a29")Seta30=HMI
6、Runtime.Tags("a30")Seta31=HMIRuntime.Tags("a31")Seta32=HMIRuntime.Tags("a32")Seta33=HMIRuntime.Tags("a33")Seta34=HMIRuntime.Tags("a34")Seta35=HMIRuntime.Tags("a35")Seta36=HMIRuntime.Tags("a36")Seta37=HMIRuntime.Tags("a37")Seta38=HMIRuntime.Tags("a38")Seta39=HMIRuntime.Tags("a39")Seta40=HMIRuntime
7、.Tags("a40")Setcount=HMIRuntime.Tags("count") sheetname="Sheet1"tagshijian=NowSetobjExcelApp=CreateObject("Excel.Application") objExcelApp.visible=False objExcelApp.workbooks.open"C:Table.xls" objExcelApp.worksheet