|
运行脚本时提示“变量未定义:Scripting”,请问高手该如何解决呢?脚本如下:(附件中的图片为运行时的结果)
Option Explicit
Dim fso, ddFilePath, i
Dim ExcelBook, ExcelSheet
ddFilePath = Environment.Value("TestDir") & "\ddFile.xls"
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(ddFilePath) Then
fso.DeleteFile(ddFilePath)
End If
wait 3
Set ExcelBook = CreateObject("Excel.Application")
Set ExcelSheet = CreateObject("Excel.Sheet")
ExcelSheet.Application.visible = False
ExcelSheet.ActiveSheet.Cells(1,1).Value = "Agent Name"
ExcelSheet.ActiveSheet.Cells(1,2).Value = "Password"
ExcelSheet.ActiveSheet.Cells(1,3).Value = "Expire Value"
ExcelSheet.ActiveSheet.Cells(1,4).Value = "Fact Value"
ExcelSheet.ActiveSheet.Cells(1,5).Value = "Execute Result"
ExcelSheet.ActiveSheet.Cells(2,1).Value = "ad"
ExcelSheet.ActiveSheet.Cells(2,2).Value = "Mercury\"
ExcelSheet.ActiveSheet.Cells(2,3).Value = "Agent name must be at least 4 characters long."
ExcelSheet.ActiveSheet.Cells(3,1).Value = "Admin"
ExcelSheet.ActiveSheet.Cells(3,2).Value = "Merc"
ExcelSheet.ActiveSheet.Cells(3,3).Value = "Incorrect password. Please try again"
ExcelSheet.ActiveSheet.Cells(4,1).Value = "Admin"
ExcelSheet.ActiveSheet.Cells(4,2).Value = "Mercury"
ExcelSheet.ActiveSheet.Cells(4,3).Value = "Flight Reservation"
ExcelSheet.SaveAs ddFilePath
ExcelBook.Quit
Set ExcelBook = Nothing |
|