51Testing软件测试论坛
标题:
vbs 语法请求查错,谢谢
[打印本页]
作者:
gdutlzl
时间:
2012-6-8 17:46
标题:
vbs 语法请求查错,谢谢
请问以下代码哪里错了?我把这段代码拷到vbs文档里,总是报错,谢谢啦
Set objfso=CreateObject("Scripting.FileSystemObject")
objfso.CreateTextFile("C:\Documents and Settings\XP\Desktop\test123.txt",True)
Set objfile=objfso.GetFile("C:\Documents and Settings\XP\Desktop\test123.txt")
Set Ofile = objfile.OpenAsTextStream(ForWriting)
Ofile.Write "testing filewriht function"
Ofile.writeblanklines(2)
Ofile.Write "testing filewriht function too"
Ofile.Close
Set Ofile=Nothing
Set objfile=Nothing
Set objfso=Nothing
作者:
gdutlzl
时间:
2012-6-8 17:57
Set objfso=CreateObject("Scripting.FileSystemObject")
objfso.CreateTextFile"C:\Documents and Settings\XP\Desktop\test123.txt"
Set objfile=objfso.GetFile("C:\Documents and Settings\XP\Desktop\test123.txt")
Set Ofile = objfile.OpenAsTextStream(ForWriting)
Ofile.Write "testing filewriht function"
Ofile.writeblanklines(2)
Ofile.Write "testing filewriht function too"
Ofile.Close
Set Ofile=Nothing
Set objfile=Nothing
Set objfso=Nothing
找到了一点错误,CreateTextFile那里不应该用括号,但去掉括号以后还是有错误
作者:
gdutlzl
时间:
2012-6-8 18:02
报错的是Set Ofile = objfile.OpenAsTextStream(ForWriting) 这句,“Invalid procedure call or argument”
作者:
正在更新
时间:
2012-6-9 15:08
Set Ofile = objfile.OpenAsTextStream(2)
作者:
正在更新
时间:
2012-6-9 15:10
或者
Const ForWriting = 2
Set Ofile = objfile.OpenAsTextStream(ForWriting)
作者:
gdutlzl
时间:
2012-6-10 10:14
确实可以了,谢谢啊
作者:
shanfeng1419
时间:
2012-6-13 10:23
学习
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2