title: QTP: Exit Test from nested function
body: <p>My test has multiple nested functions. Any function can be called from any other function. In a step, I need to read error message om webpage and retry, ignore or abort:</p>
  
  <pre><code>Function DataProcess_Errors (Arg1, Arg2, Arg3, Arg4)
  If Mybrowser1.WebTable("html tag:=TABLE","html id:=Table2","name:=WebTable","visible:=True").WebElement("html tag:=DIV", "html id:=divErrorMsg").Exist(1) Then
  If Len(Mybrowser1.WebTable("html tag:=TABLE","html id:=Table2","name:=WebTable","visible:=True").WebElement("html tag:=DIV", "html id:=divErrorMsg").GetROProperty("innertext"))&gt;0 Then
  BtnClicked = msgbox (Mybrowser1.WebTable("html tag:=TABLE","html id:=Table2","name:=WebTable","visible:=True").WebElement("html tag:=DIV", "html id:=divErrorMsg").GetROProperty("innertext"), 18, "Error occured")
      If BtnClicked = 3 Then 'if clicked "Abort" 
          ExitRun
      ElseIf BtnClicked = 4 Then 'if clicked "Retry"
          Call DataProcess_Errors (Arg1, Arg2, Arg3, Arg4) 'call this function
      ElseIf BtnClicked = 5 Then 'if clicked "Ignore"
          Exit Function 'continue to next step
      End If    
  ElseIf Mybrowser1.WebElement("html tag:=DIV", "html id:=divInfo").Exist(1) Then
  print Mybrowser1.WebTable("html tag:=TABLE","html id:=Table2","name:=WebTable","visible:=True").WebElement("html tag:=DIV", "html id:=divInfo").GetROProperty("innertext") 
  End If
  End If
  End Function
  </code></pre>
  
  <p>The problem is, the function does not exit test. I tried <code>ExitTest</code>, <code>ExitRun</code>, <code>ExitAction</code> - none of them exit the test but continue to next step.
  Tried next:</p>
  
  <pre><code>Dim qtAppObj : Set qtAppObj = CreateObject("quicktest.application")
  qtAppObj.Test.Stop
  </code></pre>
  
  <p>With this one UFT foes to debugging and just halts - nothing works but 'kill' UFT from Task Manager.</p>
  
  <p>Any advice, any suggestion?</p>
  
  <p>P.S. (Arg1, Arg2, Arg3, Arg4) should be there, because all functions are called by <code>GetRef</code>which should pass those variables to 90% of all functions in the library.</p>