标题: qtp中调用外部的vbs文件问题 [打印本页] 作者: test321123 时间: 2009-12-2 23:07 标题: qtp中调用外部的vbs文件问题 在qtp中脚本
executefile "d:\bb.vbs"
testpath="d:\q.xls"
p=1
For i=1 to 10
call excel_write( testpath,"sheet1","A",i,p)
p=p+1
Next
bb.vbs中的函数如下:
function excel_write(syspath,sheet,row,col,valuein)
set excelapp=createobject("excel.application")
set excelbook=excelapp.workbooks.open(syspath)
set excelsheet=excelbook.worksheets(sheet)
excelsheet.activate
excelapp.range(row&col).value=valuein
excelbook.saveas syspath
excelbook.close
set excelapp=nothing
set excelbook=nothing
set excelsheet=nothing
end function