51Testing软件测试论坛

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

作者: Raymondzfy    时间: 2008-6-14 16:32
标题: 运行脚本时提示“变量未定义: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
作者: 65138935    时间: 2008-6-14 16:36
添加到对象库中呢
作者: Randall    时间: 2008-6-14 17:10
这个脚本好像没什么问题,我这边跑是可以的,运行后excel文件也是对的。

可惜图片看不到。。




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