请注意,您的findById方法应返回一个对象。另外,请尝试以下代码来修复您的代码:
session.findById("wnd[0]/tbar[1]/btn[8]").press On Error Resume next myText = "x" err.clear myText = session.findById("wnd[1]/tbar[0]").Text if err.number <> 0 then myText = "" on error goto 0 If myText = "No data exists for chosen selection" Then GoTo TroubleShootInterCompany End If