Wincc报表Excel 下载本文

Sub OnClick(Byval Item) Dim MyVar1 Dim MyVar2

Dim objExcel Dim wb Dim xlsheet Dim rangee

Dim Years,mounth,Days,hours,min,sec,daysweek Dim jj,kk,year1,mounth1,Days1,hours1,min1,sec1 Dim yi,er,san,si,wu,i,i1,lei,lei1,lei2,lei3,lei4,lei5 Dim zhou,yue,nian

Dim shi,feng,miao,mytime

Dim MyHour,MyMinute,myday,mymonth,myyear,a,b,c,d,e,f

Set MyVar1=HMIRuntime.Tags(\MyVar1.Write Date

Set MyVar2=HMIRuntime.Tags(\MyVar2.Write Time

year1 = CStr(MyVar1.value)

mounth1 = CStr(MyVar2.value)

kk=\

jj=\

Set yi = HMIRuntime.Tags(\

yi.Read

Set er = HMIRuntime.Tags(\

er.Read

Set san = HMIRuntime.Tags(\

san.Read

Set si = HMIRuntime.Tags(\

si.Read

Set wu = HMIRuntime.Tags(\

wu.Read

Set objExcel = CreateObject(\

objExcel.Visible = True

Set wb=objExcel.Workbooks.Open (\

Set xlsheet = wb.sheets(\

xlsheet.range(\

xlsheet.range(\

xlsheet.range(\

xlsheet.range(\

xlsheet.range(\

wb.SaveAs kk & year1 & jj

wb.CLOSE

objExcel.quit

wb=Nothing

xlsheet = Nothing

objExcel=Nothing

End Sub