51Testing软件测试论坛

标题: QTP 脚本执行错误 [打印本页]

作者: tlp_2009    时间: 2011-11-11 22:41
标题: QTP 脚本执行错误
Dim fso,xls,spli_path
Set fso = CreateObject("Scripting.FileSystemObject")
    Set xls = CreateObject("Excel.Application")
   
    spli_path = split(environment("TestDir"),"\",-1,1)
   
    For i=0 to ubound(spli_path)
        res_path = res_path & spli_path(i) & "\"
    Next
msgbox  res_path


执行这句怎么报是抱类型错误。不知道问题在哪里?请大家帮忙看看!!
作者: wangyanzhao    时间: 2011-11-12 23:27
朋友 见下代码:解决你的问题
自定义一个enrivonment,name:test; value: D:\qtp\library
Dim fso,spli_path
Set fso = CreateObject("Scripting.FileSystemObject")   

spli_path = split(environment ("Test"),"\",-1,1)
rem 以下是调试信息
msgbox spli_path(0)
msgbox spli_path(1)
msgbox spli_path(2)

For i=0 to ubound(spli_path)
        res_path = res_path & spli_path(i) & "\"
                msgbox  res_path
Next




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