Micro Focus QTP (UFT) Forums
On Error Statement in QTP - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: On Error Statement in QTP (/Thread-On-Error-Statement-in-QTP)



On Error Statement in QTP - Charanpreet - 04-14-2011

How I can use On Error GoTo functionName statement in QTP. I don't want to use Resume Next and If possible recovery scenario also. I tried with recovery scenario by calling Function name from VBS file on any error. But it seems function nae that I defined in VBS file is nnot getting displayed in the drop down. Any help will be appreciated. Thanks.


RE: On Error Statement in QTP - Jay - 04-15-2011

See below example, hope this will help you to call error handling code in case of any error, make sure that error handler should be in the file where you called on error goto statement:

Code:
Public Sub InitializeMatrix(ByVal Var1 As Object, ByVal Var2 As Object)
   On Error GoTo ErrorHandler
   ' Insert code that might generate an error here
   Exit Sub
ErrorHandler:
   ' Insert code to handle the error here
   Resume Next
End Sub