|
问题是这样的:
Private Function QTP_WriteFile(words)
Dim fileSystemObj,fileSpec,logFile
Set fileSystemObj = CreateObject("Scripting.FileSystemObject")
fileSpec = "C:\" &"测试报告QTP"& ".txt"
Set logFile = fileSystemObj.OpenTextFile(fileSpec, 8, true)
logFile.WriteLine (CStr(words))
logFile.Close
Set logFile = Nothing
End Function
QTP_WriteFile("ddd")
以上这段代码我在QTP下输入并且运行是正确的,并且能写入文件
但是我把
Private Sub QTP_WriteFile(words)
Dim fileSystemObj,fileSpec,logFile
Set fileSystemObj = CreateObject("Scripting.FileSystemObject")
fileSpec = "C:\" &"测试报告QTP"& ".txt"
Set logFile = fileSystemObj.OpenTextFile(fileSpec, 8, true)
logFile.WriteLine (CStr(words))
logFile.Close
Set logFile = Nothing
End Sub
这个函数写到了外部的vbs文件
再在QTP中引入vbs文件,
在QTP中执行: QTP_WriteFile("ddd")
竟然报错“类型不匹配:QTP_WriteFile”
郁闷啊~~老半天找不到为什么,请各位高手帮忙啊 |
|