It is indeed a well-known issue. QTP seems to only exit reliably when the command to exit reaches up to action (actual script) level.
Create a separate reusable action (we'll call it "ExitableAction") and in it put something like this:
<font class="small">Code:</font><hr /><pre>Reporter.Filter = rfEnableAll
Reporter.ReportEvent micDone, "Stopping test run", "The script has requested that the current test run be stopped."
No need to associate this action directly to any scripts. Then in your core library make an "ExitScript" method that does this:
<font class="small">Code:</font><hr /><pre>sub ExitScript
on error goto 0
LoadAndRunAction "c:\qtp\ExitableAction", "Action1" 'substitute the relevant path
end sub</pre><hr />
Then when you call your ExitScript method it should terminate the test run there and then.
RunAction is available in QTP 9.5 may solve the purpose too.
I have a huge number of scripts and adding an external action to all of them will be very time consuming. I was wondering if there is a way to add / copy an external action during run time using AOM (something similar to associate library) ? Can someone please suggest.