The below QTP script will display a dialog box which is very similar to your msgbox function but it will close automatically after a specified number of seconds.

The script is shown below:

Set WshShell = CreateObject("WScript.Shell")

WshShell.Popup "QTP", 10, "Hello"

In the above QTP script, the title of the dialog box would be "Hello" and the text inside the dialog box would be "QTP" and it will close after 10 seconds as coded above.