发布于 2008-06-25 20:24:08
0楼
Dim fso,fileName
fileName="d:\aa.xls"
Set fso=CreateObject("s cripting.FileSystemObject")
If Not fso.FileExists(fileName) Then
MsgBox "File Not Exist!"
Set fso=Nothing
Exit Sub
End If
Set fso=Nothing
Dim xlsApp
Set xlsApp=CreateObject("Excel.Application")
xlsApp.WorkBooks.Open fileName
xlsApp.ActiveWorkBook.Sheets("sheet1").cells(1,1).value=HMIRuntime.Tags("NewTag").Read
xlsApp.ActiveWorkBook.Save
xlsApp.quit
Set xlsApp=Nothing
以上代码在6.0SP3中文版,6.0SP1中文版测试均没有问题,如果把
Set fso=CreateObject("s cripting.FileSystemObject")
注释掉,运行时提示缺少fso对象,根本无法运行。
不知为什么到你那里就不行呢?真是奇怪啊!
非淡泊无以明志,非宁静无以致远