我在QTP \ UFT上通过QC(ALM)运行测试时遇到问题(有时)。 这有点令人沮丧,因为它有时发生,我无法指出原因。
On Error Resume Next
Set mCnXLS = CreateObject("ADODB.connection")
With mCnXLS
.ConnectionString = "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};" & _
"DBQ=" & sXlsPath &";"&"HDR=Yes;ReadOnly=0;"
.Open
End With
If Err.Number <> 0 Then
MsgBox "fXLSConnect " & Err.Number & " - " & Err.Description, vbCritical, "clsDB"
reporter.ReportEvent micPass ,"dd",Err.Description &" "&Err.Number
Set mCnXLS = Nothing
Err.Clear
fXLSConnect = FALSE
Exit Function
End If
调试时,连接字符串上的excel失败。