51Testing软件测试论坛

标题: 打开测试数据文件的时候出错 [打印本页]

作者: fengxueren    时间: 2006-6-2 09:27
标题: 打开测试数据文件的时候出错
我用以下代码打开测试数据
在运行到Set TheFile = Fso.OpenTextFile("c:\Test.txt", ForReading, Flase)这个语句的时候老是报错
麻烦各位帮我看看


Dim Fso, TheFile, ReadString
Dim iPos, iLen
Dim TestNumberOne, TestNumberTwo

Set Fso = CreateObject("Scripting.FileSystemObject")
Set TheFile = Fso.OpenTextFile("c:\Test.txt", ForReading, Flase)

Do while TheFile.AtEndOfLine <>true

        ReadString = TheFile.Readline

        iPos = instr(1,ReadString,",",1)
        iLen = Len(ReadString)
        TestNumberOne = left(ReadString, iPos-1)
        TestNumberTwo = Right(ReadStrng, iLen-iPos)

Window("计算器").WinButton("TestNumberOne").Click
Window("计算器").WinButton("*").Click
Window("计算器").WinButton("TestNumberTwo").Click
Window("计算器").WinButton("=").Click

Loop
TheFile.Close
作者: Horus_Ra    时间: 2006-6-2 09:28
Set TheFile = Fso.OpenTextFile("c:\Test.txt", 1, Flase)
试试看~

还有,下次请将报错信息写清楚~
作者: fengxueren    时间: 2006-6-2 09:37
谢谢了
解决了~~下次注意^_^




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