发表于:2007-09-24 08:53:00
楼主
我做一个这样的组态按钮,我按一下它,它就把数据存在excel的表格里,每按一次依次向下存.我定义了两个全局的变量.NewTag是记录我的数据的.New1是记录次数的用来在表格中向下移位.但是出错了.不能运行.大家帮我看看哪做的不对.
Dim Tag_1
Dim i
Dim objExcelApp
Set objExcelApp=CreateObject("Excel.Application")
Tag_1=HMIRuntime.Tags("NewTag").Read
Set i=HMIRuntime.Tags("New1")
i.Read
objExcelApp.Workbooks.Open"D:\wincc_projectpractice\xinshiyan\book1.xls"
objExcelApp.Cells(i.value,1).value=Tag_1
objExcelApp.ActiveWorkbook.Save
objExcelApp.Workbooks.Close
objExcelApp.Quit
Set objExcelApp=Nothing
i.value=i.value+1
i.write