帮我看看这个脚本 完成这个任务还需要做什么

已锁定

小同学

  • 帖子

    18
  • 精华

    0
  • 被关注

    1

论坛等级:新手

注册时间:2009-04-07

普通 普通 如何晋级?

帮我看看这个脚本 完成这个任务还需要做什么

486

0

2009-06-05 09:58:12

Option Explicit
Function action
Dim DataLogSel
DataLogSel=HMIRuntime.Tags("DataLogSel").read
If DataLogSel=1 Then
Dim fname,dstr
dstr=FormatDateTime(Date)
fname="E:\"+dstr+".xls"

Dim ObjExcelApp,fso,MyFile
Set objExcelApp = CreateObject("Excel.Application")
Set fso = CreateObject("s cripting.FileSystemObject")
If fso.FileExists(fname) Then
objExcelApp.Workbooks.Open fname
Else
Set MyFile=fso.GetFile("E:\book.xls")
MyFile.Copy(fname)
objExcelApp.Workbooks.Open fname
End If

objExcelApp.Visible = False

Dim i
i=2
Do While objExcelApp.worksheets ("sheet1").Cells(i, 1).VAlue<>""
i=i+1
Loop

objExcelApp.worksheets ("sheet1").Cells(i, 2).VAlue = HMIRuntime.Tags("泵出口流量").read
objExcelApp.worksheets ("sheet1").Cells(i, 3).VAlue = HMIRuntime.Tags("过滤器后流量").read
objExcelApp.worksheets ("sheet1").Cells(i, 4).VAlue = HMIRuntime.Tags("加药流量").read
objExcelApp.worksheets ("sheet1").CelLs(i, 5).VAlue = HMIRuntime.Tags("过滤器后压力").read
objExcelApp.worksheets ("sheet1").Cells(i, 6).VAlue = HMIRuntime.Tags("灭活器后压力").read
objExcelApp.worksheets ("Sheet1").Cells(i, 7).VAlue = HMIRuntime.Tags("旋分器后压力").read
objExcelApp.worksheEts ("sheet1").Cells(i, 8).VAlue = HMIRuntime.Tags("旋分器跨接阀前压力").read
objExcelApP.worksheets ("sheet1").Cells(i, 9).VAlue = HMIRuntime.Tags("旋分器入口压力").read
objEXcelApp.worksheets ("sheet1").Cells(i, 10).VAlue = HMIRuntime.Tags("主泵出口压力").reaD
objExcelApp.worksheets ("sheet1").Cells(i, 11).Value = HMIRuntime.Tags("过滤罐1压差表").Read
objExcelApp.worksheets ("sheet1").Cells(i, 1).VAlue =Now
objExcelApp.ActiveWorkbook.save
objExcelAPp.Workbooks.ClosE

ojEXcelapp.quiT
Set ObjEXceLapp = Nothing

End If
帮我看看这个脚本 完成这个任务还需要做什么 已锁定
编辑推荐: 关闭

请填写推广理由:

本版热门话题

SIMATIC WinCC / Panel

共有32772条技术帖

相关推荐

热门标签

相关帖子推荐

guzhang

恭喜,你发布的帖子

评为精华帖!

快扫描右侧二维码晒一晒吧!

再发帖或跟帖交流2条,就能晋升VIP啦!开启更多专属权限!

  • 分享

  • 只看
    楼主

top
X 图片
您收到0封站内信:
×
×
信息提示
很抱歉!您所访问的页面不存在,或网址发生了变化,请稍后再试。