回复:做工程急 大哥们帮帮我

Nye

  • 帖子

    24
  • 精华

    0
  • 被关注

    0

论坛等级:新手

注册时间:2003-06-06

普通 普通 如何晋级?

发布于 2006-07-05 13:46:02

0楼

Option Explicit

Function action

Dim fso,myfilep,daystr,dstr,fname

Set fso = CreateObject("s cripting.FileSystemObject")

dstr = FormatDateTime(Date)



HMIRuntime.Tags("i").write fso.GetAbsolutePathName("")

fname=HMIRuntime.ActiveProject.Path++dstr+.xls



Dim ObjExcelApp



Set objExcelApp = CreateObject("Excel.Application")

objExCelApp.Visible = True

objExcelApp.Workbooks.Open fname



Dim i

i=1



Do While objExcelApp.worksheets ("sheet1").Cells(i, 1).VAlue<>""

i=i+1

Loop





objExcelApp.worksheets ("sheet1").Cells(i, 2).VAlue = HMIRuntime.Tags("I-COD").read

objExcelApp.worksheets ("sheet1").Cells(i, 3).VAlue = HMIRuntime.Tags("I-SS").read

objExcelApp.worksheets ("sheet1").Cells(i, 4).VAlue = HMIRuntime.Tags("I-PH").read

objExcelApp.worksheets ("sheet1").Cells(i, 5).VAlue = HMIRuntime.Tags("I-F").read

objExcelApp.worksheets ("sheet1").Cells(i, 6).VAlue = HMIRuntime.Tags("I-FI").read

objExcelApp.worksheets ("sheet1").Cells(i, 7).VAlue = HMIRuntime.Tags("O-COD").read

objExcelApp.worksheets ("sheet1").Cells(i, 8).VAlue = HMIRuntime.Tags("O-SS").read

objExcelApp.worksheets ("sheet1").Cells(i, 9).VAlue = HMIRuntime.Tags("O-NH4N").read

objExcelApp.worksheets ("sheet1").Cells(i, 10).VAlue = HMIRuntime.Tags("0-P").read

objExcelApp.worksheets ("sheet1").Cells(i, 11).VAlue = HMIRuntime.Tags("O-F").read

objExcelApp.worksheets ("sheet1").Cells(i, 12).VAlue = HMIRuntime.Tags("O-FI").read

objExcelApp.worksheets ("sheet1").Cells(i, 1).VAlue =Now

objExcelApp.ActiveWorkbook.Save

objExcelApp.Workbooks.ClosE

objExcelApp.QuiT



Set ObjEXceLapp = Nothing



End Function
这一段怎么运行不了啊 显示fname=HMIRuntime.ActiveProject.Path++dstr+.xls这段错误
评论
编辑推荐: 关闭

请填写推广理由:

本版热门话题

SIMATIC WinCC / Panel

共有32567条技术帖

相关推荐

热门标签

相关帖子推荐

guzhang

恭喜,你发布的帖子

评为精华帖!

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

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

  • 分享

  • 只看
    楼主

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