i have seen such thing long, long ago.
unfortunatly if have no access to the code.
but, i can make a guess how this was working.
either it used win32 functions, but this would need a some sort of callback functions (can be done in vb), so i assume it was something like this:
create a form that you can use for displaying message. create a new document (i think there's no reason to save it), use editdocument or dialogbox to display that document. in forms queryopen (or whatever) register a notestimer, set it to 5 sec, in event alarm try to close (ws.currentdocument should be the one you've opened) this document.
so done, ws.editdocument/dialogbox should return either if user pressed cancel/ok, or alarm was triggered.