My answer may be not good... I am a newbie to QTP...
Is the code available in the Main test or is available in a seperate vbs file??
I have faced a similar situation, but still not able to find a solution for the issue. In my case,I need to enter some text in the javalist and hit on the enter button.
I used wshell object. And also used mercury.devicerelpay object. The script worked fine when the script is available in the main test. But when I copy the code in a vbs file and asscociate it with a test and run it, the script fails.