WINCC7.0 VB全局脚本实现报表问题求教

已锁定

加图索

  • 帖子

    5
  • 精华

    0
  • 被关注

    0

论坛等级:新手

注册时间:2009-03-12

普通 普通 如何晋级?

WINCC7.0 VB全局脚本实现报表问题求教

822

2

2013-01-04 10:26:31

新建了一个项目,使用6.2用过的一个VB全局脚本实现报表,现在copy到7.0 SP1上就没法用了,好像没有执行写入EXCEL的步骤,求教一下是不是7.0和6.2有什么不同,附上脚本内容:
Option Explicit
Function action

Dim objExcelAPP
Dim reportfile
Dim reportfile1
Dim reportfile2
Dim reporttime
Dim index
Dim reporttime1
Dim j
Dim i

index=Hour(Now)
index=CInt(index)
reportfile=CStr(Date)
reporttime=Hour(Now)
reporttime=CStr(reporttime)
reportfile=reportfile
reportfile1=reportfile
reportfile="D:\report\" & reportfile & ".xls"
Dim SO2
Set SO2 = HMIRuntime.Tags("SO2")
Dim reportname
Set reportname = HMIRuntime.Tags("reportname")

SO2.Read

Set objExcelAPP=CreateObject("Excel.Application")
objExcelAPP.Visible=False
objExcelAPP.Workbooks.Open "D:\yucai0104\book.xls"
With objExcelAPP

If index=0Then
For i=5 To 18
For j= 2 To 25
.cells(i,j).value=Null
Next
Next


.cells(2,2).value=Date
End If
If index>=9 Then
i=(index-0)+2
End If
If index<=8 Then
i=index+2

End If

.cells(5,i).value=SO2.Value

If index=23Then


.ActiveWorkbook.SaveAs reportfile
reportname.Write reportfile1





Else
.ActiveWorkbook.Save
End If

.ActiveWorkbook.Close
.Quit
End With
Set objExcelAPP=Nothing

End Function

想请教高手,该作何改动?谢谢。。
WINCC7.0 VB全局脚本实现报表问题求教 已锁定
编辑推荐: 关闭

请填写推广理由:

本版热门话题

SIMATIC WinCC / Panel

共有32964条技术帖

相关推荐

热门标签

相关帖子推荐

guzhang

恭喜,你发布的帖子

评为精华帖!

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

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

  • 分享

  • 只看
    楼主

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