51Testing软件测试论坛

标题: 运行脚本时提示“变量未定义:Scripting” [打印本页]

作者: Raymondzfy    时间: 2008-6-14 16:34
标题: 运行脚本时提示“变量未定义:Scripting”
运行脚本时提示“变量未定义: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
作者: 风过无息    时间: 2008-6-16 08:30
哪行出错,没看见附件.




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2