您的当前位置:首页正文

WinCC与Excel的互连(VBS原创)

来源:九壹网
WinCC与Excel的互连(VBS原创) 顶 0踩 0回复 8 | 人气 967 | 打印 更多0 给TA发消息 加TA为好友 发表于:2007-08-09 12:33:00 楼主 看了论坛中其他WinCC与Excel的互连的文章,我也把另一种途径与大家分享,虽然复杂一点,但是运行还算稳定,读写方便。 Dim objExcelApp

Set objExcelApp = CreateObject(\"Excel.Application\") objExcelApp.Visible = True ' Dim NO

Set NO = HMIRuntime.Tags(\"NO\") Dim TrackNO

Set TrackNO = HMIRuntime.Tags(\"TrackNO\") Dim Company

Set Company = HMIRuntime.Tags(\"Company\") Dim SheetNO

Set SheetNO = HMIRuntime.Tags(\"SheetNO\") Dim Product

Set Product = HMIRuntime.Tags(\"Product\") Dim SetPoint

Set SetPoint = HMIRuntime.Tags(\"SetPoint\")

objExcelApp.Workbooks.Open\"D:\\UCC\\data\\Book1.xls\" NO.Value = objExcelApp.Cells(2,1).Value TrackNO.Value = objExcelApp.Cells(2,2).Value Company.Value = objExcelApp.Cells(2,3).Value SheetNO.Value = objExcelApp.Cells(2,4).Value Product.Value = objExcelApp.Cells(2,5).Value SetPoint.Value = objExcelApp.Cells(2,6).Value

objExcelApp.ActiveWorkbook.Save

objExcelApp.Workbooks.Close objExcelApp.Quit

Set objExcelApp = Nothing

NO.Write TrackNO.Write Company.Write SheetNO.Write Product.Write SetPoint.Write

因篇幅问题不能全部显示,请点此查看更多更全内容

Top