tlp_2009 发表于 2011-11-11 22:41:10

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
msgboxres_path


执行这句怎么报是抱类型错误。不知道问题在哪里?请大家帮忙看看!!

wangyanzhao 发表于 2011-11-12 23:27:21

朋友 见下代码:解决你的问题
自定义一个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) & "\"
                msgboxres_path
Next
页: [1]
查看完整版本: QTP 脚本执行错误